嗨,像问题状态,我想在一个的UIDatePicker而不使用presentModalViewController或pushViewController滑动并随后隐藏应用程序的主UITabBar。现在,我加入的UIDatePicker子视图与导航栏几个按钮到一个临时的UIViewController,并初始化一个UINavigationController与临时控制器作为根。我在以覆盖UITabBar试图加入这个导航控制器作为子视图self.navigationController.tabBarController,但是当我设置UITabBar为隐藏,我看到的是白色的它下面,没有的UIDatePicker可见。任何建议?

注意:我给这理由是,我不能想出一个办法使用presentModalViewController与小于屏幕的图

有帮助吗?

解决方案

如果你需要设计这样的:

“http://clip2net.com/clip/m13204/1248480575-clip-22kb.jpg”

您可以读取样本(UIActionSheet +的UIDatePicker)href="https://stackoverflow.com/questions/349858/fitting-a-uidatepicker-into-a-uiactionsheet">。也请参阅UICatalog苹果样品,以获得更多。

其他提示

答案此处,隐藏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;
}

<强>更新修饰的代码(在模拟器测试)和iPhone(未测试,但希望它的工作)在两个ipad公司上班 https://stackoverflow.com/a/8584684/336422

您可以看看从苹果DateCell例子。从底部的UIDatePicker幻灯片一样的UITextField的键盘,当你调用becomeFirstResponder。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top