iphone - 隐藏UITabBar而不使用presentModalViewController或pushViewController

jme*_*do3 0 iphone objective-c uinavigationcontroller uitabbar

嘿伙计们,就像问题所说,我试图在不使用presentModalViewController或pushViewController的情况下在UIDatePicker中滑动,然后隐藏应用程序的主UITabBar.现在,我将UIDatePicker子视图与导航栏上的几个按钮添加到临时UIViewController,并使用该临时控制器作为根初始化UINavigationController.我将此导航控制器作为子视图添加到self.navigationController.tabBarController以尝试覆盖UITabBar,但是当我将UITabBar设置为隐藏时,我看到的只有白色,没有UIDatePicker可见.有什么建议?

注意:我的理由是我无法想出一种方法来使用带有小于屏幕的视图的presentModalViewController.

SAK*_*isT 5

在这里回答,隐藏UiTabBar

更新:来自链接的代码

BOOL hiddenTabBar;
UITabBarController *tabBarController;

- (void) hideTabBar {

     [UIView beginAnimations:nil context:NULL];
     [UIView setAnimationDuration:0.4];
     for(UIView *view in tabBarController.view.subviews)
     {
          CGRect _rect = view.frame;
          if([view isKindOfClass:[UITabBar class]])
          {
               if (hiddenTabBar) {
                    _rect.origin.y = 431;
                    [view setFrame:_rect];
               } else {
                    _rect.origin.y = 480;
                    [view setFrame:_rect];
               }
          } else {
               if (hiddenTabBar) {
                    _rect.size.height = 431;
                    [view setFrame:_rect];
               } else {
                    _rect.size.height = 480;
                    [view setFrame:_rect];
               }
          }
     }    
     [UIView commitAnimations];

     hiddenTabBar = !hiddenTabBar;
}
Run Code Online (Sandbox Code Playgroud)

更新:修改代码在iPad(在模拟器中测试)和iPhone(未经测试,但希望它可以工作)上工作 /sf/answers/600927911/