iPhone 如何关闭 UITabBarController 然后再次显示它?
我会尽力解释自己,我知道标题并没有说明太多。基本上我有 4 个导航控制器嵌入在选项卡栏控制器中。
我想要做的是让这个导航控制器之一推送一个嵌入到选项卡栏控制器中的新导航控制器,从而消除原始选项卡栏控制器。当用户单击导航控制器上的后退按钮时,将调用原始选项卡栏控制器。
我尝试简单地在导航控制器中推送新的选项卡栏控制器,但当然,我现在在视图中看到了 2 个选项卡栏。目前我正在做的事情是让导航控制器将我的新选项卡栏控制器呈现为模态视图,并且它工作正常。但我的导航控制器中没有后退按钮,所以目前我只是关闭我的模态视图,我想这有点相同。
我在代码中有这个:
myTabBarController = [[UITabBarController alloc] init]; myTabBarController.viewControllers = [NSArray arrayWithObjects:myNewsNavController, mostPopularController, myAboutNavController, nil];
其中 myNewsNavController 是包含链接到 TableView 的视图控制器的导航控制器,然后当用户单击 accesoryButton 时,它会立即显示模式控制器。
但我认为如果有后退按钮的话用户体验会更好。
那么我怎样才能关闭选项卡控制器呢?然后当关闭模态视图时,它又会回来吗?任何帮助将不胜感激。谢谢。
-奥斯卡
I will try to explain myself as best as possible, I know the title does not say much. Basically i have 4 Navigation Controllers embedded in Tab Bar Controller.
What I want to do is have one of this Navigation Controllers push a new Navigation Controller embeded in aTab Bar Controller dismissing the original Tab Bar Controller. When the user clicks the back Button on the Navigation Controller the original Tab Bar Controller is called.
I tried simply pushing the new Tab Bar Controller in the Navigation Controller, but of course i get now 2 tab bars in my view. At the moment what I am doing is having the navigation controller present my new Tab Bar Controller as a modal View and it works Ok. But I do not have the back button in the Navigation Controller so at the moment I just dismiss my Modal View, which I guess is kinda the same.
I have this in code:
myTabBarController = [[UITabBarController alloc] init];
myTabBarController.viewControllers = [NSArray arrayWithObjects:myNewsNavController, mostPopularController, myAboutNavController, nil];
Where myNewsNavController is Navigation Controller containing a View Controller linked to a TableView then when the user tabs the accesoryButton it presents the modal Controller at the moment.
But I think the user experience would be better if there was a back button instead.
So how can I dismiss the Tab Controller? and then when dismissing the modal view have it back again?. Any help will be Greatly appreciated. Thank you.
-Oscar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定你到底想要什么,但是你尝试过设置
吗?
I'm not sure exactly what you want, but have you tried setting
?
您必须在要推入视图的控制器上设置 hidesBottomBarWhenPushed = YES...
You have to set hidesBottomBarWhenPushed = YES on the controller you are going to push into the view...