在 iOS 导航期间更改 UITabBar
当我的应用程序启动时,它会呈现一个导航视图,底部有一个表格视图和一个选项卡栏。
像这样:
TabBar --> UINav1, UINav2, UINav3, UINav4
每个 UINav 都包含一个最终显示的 ViewController。
我想要做的是,如果用户从 ListView(主屏幕)移动到详细视图,则更改 UITabBar。
我不必更换整个选项卡栏,至少可以更改/删除按钮。
但是,如果我使用上面的模型(将 TabBarController 设置为根控制器),那么它似乎在导航过程中几乎被卡住并且不可变。我能做的最好的就是将其隐藏在某些视图中。
我已经敲了一天的头试图弄清楚这一点。
谢谢!
When my app launches, it presents a navigation view with a tableview and a tabbar on the bottom.
Something like this:
TabBar --> UINav1, UINav2, UINav3, UINav4
Each UINav contains a ViewController that is eventually displayed.
What I want to be able to do is to change the UITabBar if the user moves from the ListView (Main screen) to the detail view.
I don't have to swap out the whole tabbar atleast change/remove the buttons.
However, if I use the above model (setting TabBarController as the root controller) then it seems it's pretty much stuck and immutable in the course of the navigation. The best I can do is just hide it in certain views.
Been banging my head for like a day trying to figure this out.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在 UITabBarController 中使用
您希望的任何 viewController 设置 tabBar
编辑:您可能不想看这个问题希望似乎非常相似 iPhone,如何隐藏标签栏按钮?
You could use
in your UITabBarController to set the tabBar whatever viewController you wish
EDIT: You might wan't to look at this question wish seems to be quite similar iPhone, how I hide a tab bar button?
这并不常见,但您可以以模态方式呈现新的选项卡栏控制器及其关联的视图。
假设您的 listView 是 UITableViewController,您可以在
didSelectRowAtIndexpath
方法中推送新的选项卡栏控制器。PS:在这种情况下,我会非常小心地构建 UI,因为它可能会让用户感到非常困惑)。
我希望它有帮助。
罗格
It is not very common but you can present a new tab bar controller along with its associated view(s) modally.
Assuming your listView is a UITableViewController, you can push the new tab bar controller in your
didSelectRowAtIndexpath
method.PS: I would be very careful with how you structure your UI in this case as it can get quite confusing for the user).
I hope it helps.
Rog
经过进一步研究,认为这是不可行的。
Upon further research, decided that this was not feasible to do.