按下按钮以允许全屏查看内容时是否可以隐藏选项卡栏?
我的基于导航的应用程序的详细视图中有一个 UITabBar。 我将文本和图像存储在表格视图中,并希望用户能够点击单元格来隐藏导航控制器和选项卡栏,以便全屏查看内容。
我找到了隐藏顶部栏的代码,但隐藏选项卡栏似乎并不容易。
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
[self.navigationController setNavigationBarHidden:YES animated:YES];
有谁知道如何做到这一点?
一旦视图已经加载,此代码就无法隐藏 tabBar。
yourTabViewController.hidesBottomBarWhenPushed = YES;
这是我找到的代码。 似乎只有在加载视图时才起作用,因此一旦标签栏已经出现,它就不能用于隐藏标签栏。 我仍在努力完成这项工作。 请帮忙!!!
self.tabBarController.tabBar.hidden = YES;
I have a UITabBar in the detail view of my navigation based application. I am storing text and images in a tableview and would like the user to be able to tap on a cell to hide the navigation controller and the tabbar for full screen viewing of the content.
I found this code for hiding the top bars, but it does not seem as easy to hide the tabbar.
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
[self.navigationController setNavigationBarHidden:YES animated:YES];
Does anyone know how to do this?
This code does not work to hide the tabBar once the view is already loaded.
yourTabViewController.hidesBottomBarWhenPushed = YES;
This is the code I found. Seems to only work when the view is loaded though, so it can't be used to hide the tabbar once it has already appeared. I'm still struggling to make this work. Please help!!!
self.tabBarController.tabBar.hidden = YES;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
有一种内置方法可以执行此操作:
self.hidesBottomBarWhenPushed = YES;
但是您必须在推送视图之前执行此操作。 这就是您可能想要使用它的方式:
There's a built-in way to do this:
self.hidesBottomBarWhenPushed = YES;
But you have to do this BEFORE the view is pushed. This is how you might want to use that:
我发现的最好的解决方法是更改视图大小,使其覆盖选项卡栏。 这是我在选择一行时隐藏 statusBar、navBar 和 tabBar 的代码:
The best workaround I have found is to change the view size so that it covers the tabbar. Here's my code for hiding the statusBar, navBar, and tabBar when a row is selected:
我的解决方案:
您必须添加
#import
My solution:
You have to add
#import <QuartzCore/QuartzCore.h>
我找到了这个问题的一个答案,非常简单且有效。
解决方案是在应用程序的所有视图、视图控制器和选项卡栏控制器中设置选项“按下时隐藏底部栏”。
无论如何,您可以在 IB 中或通过代码来完成此操作。
希望这对大家有帮助...
I´ve found one answer to this issue, is very simple and effective.
The solution is to set the option "Hides Bottom Bar on Push" in ALL VIEWS, VIEW CONTROLLERS and TAB BAR CONTROLLERS of your app.
You can do this in IB or by code anyway.
Hope you this helps everyone...
为了调整窗口的大小,您首先需要在检查器窗口的“属性”选项卡下的状态栏字段中选择“无”选项。 然后,Interface Builder 将允许您更改窗口的大小。
In order to adjust the size of your window, you first need to select the option of NONE in the status bar field, under your Attributes tab, of your Inspector window. Interface Builder will then let you change the size of your window.
如果有人需要 MonoTouch 版本操作系统,可以使用这个很酷的小技巧。 (谢谢!)
In case any one needs the MonoTouch version os this cool little trick. (thanks!)