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

发布于 2024-08-29 20:42:22 字数 176 浏览 4 评论 0原文

我有一个使用选项卡栏控制器和导航控制器的应用程序。但是对于某些页面,我想隐藏这两个栏(选项卡和导航),之后它们将再次可见...我能够隐藏导航酒吧和酒吧也完成了制作。它出现在一些页面之后。 我可以隐藏标签栏 - (BOOL)隐藏BottomBarWhenPushed{ 返回真; 但

问题是如何使其在某些页面后再次可见?

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 visible 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝天 2024-09-05 20:42:22
[[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;

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

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文