如何隐藏某些页面的tabbar并使其再次可见?

pri*_*iya 0 iphone objective-c uitabbarcontroller tabbarcontroller

我有一个应用程序,它使用一个标签栏控制器和一个导航控制器.但是对于某些页面,我想隐藏两个栏(标签和导航)之后,那些将再次可见...我能够隐藏导航栏并且还完成了制作.它出现在一些页面之后.我可以隐藏标签栏 - (BOOL)hidesBottomBarWhenPushed {return TRUE; }

但问题是如何在某些页面后再次显示它?

ada*_*dam 6

[[self navigationController] setNavigationBarHidden:UIDeviceOrientationIsLandscape(toInterfaceOrientation) animated:YES];
Run Code Online (Sandbox Code Playgroud)

然后在子类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;

}
Run Code Online (Sandbox Code Playgroud)