标签栏无法访问导航控制器
我有一个 navigationController 应用程序。
我将标签栏推到视图上。 选项卡的工作标题已更改,完美。 现在我的一个选项卡有一个列表,我尝试链接到选项卡栏中的子页面:
NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"ProfileDetailController" bundle:nil];
[self.navigationController pushViewController:nextController animated:YES];
什么也没有发生。 当然这是可行的:
self.view = nextController.view;
我希望能够在我的选项卡栏中推送到此子页面并更改导航栏按钮。 这可能吗?
I have a navigationController app.
I push a tabbar onto the view. Tabs are working title is changed, perfect. Now one of my tabs has a list and I try to link out to a child page within the tabbar:
NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"ProfileDetailController" bundle:nil];
[self.navigationController pushViewController:nextController animated:YES];
Nothing happens. Course this works:
self.view = nextController.view;
I want to be able to push to this subpage within my tabbar AND change the navigationbars buttons. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您正在将
UITabBarController
推送到UINavigationController
上? 来自 Apple 文档,您无法将标签栏控制器推到导航控制器上。您可能想要做的是相反的:有一个选项卡栏控制器,其中 UINavigationController 作为选项卡项。 这类似于 iPod 应用程序或电话应用程序中的界面。
It sounds like you're pushing a
UITabBarController
onto aUINavigationController
? From Apple's documentation, you can't push a tab bar controller onto a navigation controller.What you probably want to do is the opposite: have a tab bar controller with
UINavigationController
s as the tab items. This is similar to the interface in, say the iPod app or Phone app.我同意 Alex 的观点 - 导航控制器内的 TabBarController 似乎不是一个很好的 UI 模式。
无论如何,回答你的问题:你是否尝试过通过标签栏控制器访问导航控制器?
我不确定这是否有效,但你可以尝试一下。
I agree with Alex - a TabBarController inside a navigation controller doesn't seem like a nice UI pattern.
Anyways, to answer your question: Have you tried to access the navigation controller via the tab bar controller?
I'm not sure if this works, but you could give it a try.
我想我找到了一个简单的解决方案。
在您想要推送视图的类中,将本地
UINavigationController
声明为属性:记住要综合它。
在您的
tabBarController
类中:之后您可以执行
[self.navigationController PushViewController:nextControllerAnimated:YES];
I think I found an easy solution.
In your class where you want to push a view, declare a local
UINavigationController
as a propterty:Remember to synthesize it.
In your class for the
tabBarController
:After that you can do
[self.navigationController pushViewController:nextController animated:YES];