0

ナビゲーション コントローラーと共にタブ バー コントローラーを使用するアプリケーションを持っています。 &作成も完了。いくつかのページの後に表示されます。- (BOOL)hidesBottomBarWhenPushed{ return TRUE; でタブ バーを非表示にできます。}

しかし、問題は、いくつかのページの後に再び表示するにはどうすればよいですか?

4

1 に答える 1

6
[[self navigationController] setNavigationBarHidden:UIDeviceOrientationIsLandscape(toInterfaceOrientation) animated:YES];

次に、サブクラス化されたUITabBarControllerで

- (void) hideTabBar:(BOOL)hide animated:(BOOL)animated {

    if (tabBarHidden == hide) { return; }

    if (animated) {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1.5];
    }

    for(UIView *view in self.view.subviews) {

        if([view isKindOfClass:[UITabBar class]]) {

            if (!hide) {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y-49, view.frame.size.width, view.frame.size.height)];
            } else {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y+49, view.frame.size.width, view.frame.size.height)];
            }
        } else {
            if (!hide) {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height-49)];
            } else {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height+49)];
            }

        }
    }

    if (animated) { [UIView commitAnimations]; }

    tabBarHidden = hide;

}
于 2010-04-22T12:02:30.107 に答える