2010-11-21 17 views
2

我敢肯定,我已經看到這個地方這個地方的代碼,但我找不到它...可能滑下UITabBarController?

我想能夠以編程方式滑下UITabBarController ...不在轉換時到另一種觀點,但在相同的觀點。

回答

4

如果你想在UITabBar滑下去了,你可以嘗試這樣的:

- (IBAction)showHideTabBar:(id)sender { 
    static BOOL isShowing = YES; 

    CGRect tabBarFrame = self.tabBarController.tabBar.frame; 

    if (isShowing) { 
     tabBarFrame.origin.y += tabBarFrame.size.height; 
    } 
    else { 
     tabBarFrame.origin.y -= tabBarFrame.size.height; 
    } 

    isShowing = !isShowing; 

    [UIView animateWithDuration:0.3 animations:^ { 
     [self.tabBarController.tabBar setFrame:tabBarFrame]; 
    }]; 
} 
+0

我覺得上面的解決方案會留下空白區域不能被繪製標籤欄的大小。這可能與操作系統版本有關。我正在講iOS 5.1。我目前的解決方法涉及將我的視圖從其控制器移動到標籤欄控制器,以便它*可以*繪製在底部區域。不太漂亮,而且更喜歡更優雅的解決方案 - 當視圖更改控制器時,動畫會跳轉。 – 2012-04-18 18:35:56

相關問題