如何在第一次加载时隐藏 tabBar,并在以后的屏幕上显示?
.hidesBottomBarWhenPushed = 否;不起作用,因为视图没有被推送。我希望 tabBar 在第一个屏幕上隐藏,并能够在几个屏幕后再次显示。
我该怎么做?
.hidesBottomBarWhenPushed = NO; doesn't work because the view isn't getting pushed. I want the tabBar to be hidden on the first screen and able to show it again a few screens later.
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
子类化你的 UITabBarController 并添加一个像这样的函数
当你在做的时候,添加一个像这样的函数来允许标签栏旋转
Subclass your UITabBarController and add a function like this
Whilst your at it, add a function like this to allow the tab bar to rotate
这将很困难,因为选项卡栏被设计为应用程序 UI 的顶层。文档对此非常清楚。因此,它们在不在顶层的控制器层次结构中表现不佳。
实际上,完成您想要的操作的唯一方法是在您希望它出现时以编程方式创建选项卡栏。但是,我不能说这会产生可靠的代码。标签栏将一路与你战斗。
你真的应该重新考虑你的 UI 设计。以非标准方式使用选项卡栏会让您的用户感到困惑。由于标准是在 UI 的顶层设置选项卡栏,因此当用户看到选项卡栏时,他们会认为自己处于顶层。他们会迷失方向。您确实需要坚持标准用法,以便您的应用程序符合用户已经学习的界面语法。
请参阅 iPhone 人机界面指南。
This is going to be difficult because tabbars are designed to be the top level of the application's UI. The documentation is very clear on this. As such, they don't play well in a controller hierarchy in which they are not on top.
Really the only way to accomplish what you want is programmatically create the tabbar when you want it to appear. However, I can't say that will produce reliable code. The tabbar will be fighting you all the way.
You really should rethink your UI design. Using the tabbar in a non-standard way will confuse your users. Since the standard is to have tabbars at top level of the UI, users will believe they are at the top level when they see a tabbar. They will get disoriented. You really need to stick to standard usage so that your app agrees with the interface grammar that the users have learned.
See the iPhone Human Interface Guidelines.