2009-07-24 76 views
0

嘿,像問題的狀態,我試圖滑動UIDatePicker而不使用presentModalViewController或pushViewController,隨後隱藏應用程序的主要UITabBar。現在,我將UIDatePicker子視圖與導航欄上的幾個按鈕一起添加到臨時UIViewController,並以該臨時控制器爲根初始化UINavigationController。我將這個導航控制器作爲子視圖添加到self.navigationController.tabBarController中,試圖覆蓋UITabBar,但是當我將UITabBar設置爲隱藏時,我所看到的全部都是白色,並且沒有顯示UIDatePicker。有什麼建議麼?iphone - 隱藏UITabBar沒有presentModalViewController或pushViewController

注意:我的推理是我不能找出一種方法來使用presentModalViewController的視圖小於屏幕。

回答

5

回答here,隱藏UiTabBar

UPDATE:從鏈路

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; 
} 

UPDATE代碼:修改的代碼在兩個iPad上運行(在模擬器測試)& iPhone(未測試,但希望它會工作) https://stackoverflow.com/a/8584684/336422

0

你可以有一個lo好的來自Apple的DateCell示例。當您調用becomeFirstResponder時,UIDatePicker像UITextField的鍵盤一樣從底部滑動。

相關問題