본문 바로가기

개발도구/iOS - 아이폰 개발

[iOS] tabbarcontroller hide기 / 탭바 숨기기

-(IBAction)btnEdit:(id)sender{    

    CGRect frame = self.tabBarController.view.superview.frame;

    CGFloat offset = self.tabBarController.tabBar.frame.size.height;

    frame.size.height += offset;    

    //  self.tabBarController.view.frame = frame;

    

    [UIView animateWithDuration:0.2

                     animations:^{

                         self.tabBarController.view.frame = frame;

                     } ];    

}


-(IBAction)btnEdit1:(id)sender{    

    CGRect frame = self.tabBarController.view.superview.frame;

    CGFloat offset = self.tabBarController.tabBar.frame.size.height;

    frame.size.height -= offset;    

    //  self.tabBarController.view.frame = frame;

    

    [UIView animateWithDuration:0.2

                     animations:^{

                         self.tabBarController.view.frame = frame;

                     } ];   

}


탭바 숨기기

탭바 기반의 네비게이션뷰에서 네비게이션을 푸쉬하고 넘어갔을때 탭바가 없길 바란다면, 아래와 같이

푸쉬하기 전에 탭바를 숨겨야 한다.

DetailViewController *detail_rootview = [[DetailViewController allocinitWithNibName:@"DetailViewController" bundle:nil];

//TabBar 미리 없애고 Push 해주어야 한다.

detail_rootview.hidesBottomBarWhenPushed = YES;