开发者

How to hide tabbar for some pages and make it visible again?

开发者 https://www.devze.com 2022-12-28 03:44 出处:网络
I\'ve got an application that uses a Tab Bar Controller along with a Navigation Controller.But for some pages I want to hide both bars(Tab & navigation) after that those will be visibl开发者_开发百

I've got an application that uses a Tab Bar Controller along with a Navigation Controller.But for some pages I want to hide both bars(Tab & navigation) after that those will be visibl开发者_开发百科e again...I am able to hide navigation bar & also done with making. it appear after some pages. I am able to hide tab bar with - (BOOL)hidesBottomBarWhenPushed{ return TRUE; }

But problem is how do I make it Visible again after some pages?


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

then in a subclassed 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;

}
0

精彩评论

暂无评论...
验证码 换一张
取 消