iPhone - 按下控制器并同时切换选项卡
在常见的 iPhone 配置中,我的应用程序的主窗口是一个包含多个 UINavigationController 的选项卡栏控制器。我现在的绊脚石是同时推动和更改控制器:看来我可以按顺序执行这两项操作,但我必须再次按选项卡才能更新视图。
例如,我在选项卡 1 上,有一个按钮可以在选项卡 2 上加载我想要立即呈现的新视图。代码是
tabController.selectedViewController = myListsController;
EditListViewController * editController = [[EditListViewController alloc] initWithList:l];
[myListsController.navigationController pushViewController:editController animated:YES];
使用此代码,会显示新选项卡,但我没有看到新视图。这可以做到吗?
In a common iPhone configuration, my application's main window is a tab bar controller that contains multiple UINavigationController. My stumbling block now is pushing and changing controllers simultaneously: it appears that I can do both sequentially, but I have to press the tab again to have the view updated.
For example, I'm on tab 1, and I have a button that will load a new view on tab 2 that I want to present right away. Code for that is
tabController.selectedViewController = myListsController;
EditListViewController * editController = [[EditListViewController alloc] initWithList:l];
[myListsController.navigationController pushViewController:editController animated:YES];
With this code, the new tab is presented, but I don't see the new view. Can this be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只有 2 个选项卡视图(并且
myListsController.navigationController
是第二个选项卡的根),您可以这样做:If you have only 2 tab views (and
myListsController.navigationController
is the root of your 2nd tab), you could do it like this:尝试一下。
在 Viewcontroller 类中
Try
in you Viewcontroller class.