我正在为 Iphone/Ipad 编写目标 c 中的应用程序。我在标签栏的“更多”中有一些项目。我想切换到其中一种观点。我该怎么做?通常我会使用 selectedIndex,但它在“更多”选项卡上不起作用。
问问题
2472 次
2 回答
5
要从更多屏幕中选择视图控制器,您应该首先选择更多视图控制器,因为它在之前的答案中显示:
[tabBarController setSelectedViewController: [tabBarController moreNavigationController]]
然后执行 pushViewController 方法以获得更多视图控制器
[[tabBarController moreNavigationController] pushViewController:neededViewController animated:NO]
或者使用更好的方法:
[tabBarController setSelectedViewController: neededViewController ]
于 2013-03-26T13:16:59.640 回答
1
[myTabBarController setSelectedViewController: viewControllerThatYouNeed];
Edit:
Try to use selectedViewController property of UITabBarController. From Apple Docs:
Blockquote In iOS 3.0 and later, you can use this property to select any of the view controllers in the viewControllers property. This includes view controllers that are managed by the More navigation controller and whose tab bar items are not visible in the tab bar.
于 2013-03-26T12:48:49.950 回答