How to switch to a tabbar item in the “More” View?

天涯浪子 提交于 2019-12-13 07:04:44

问题


I'm programming an app in objective c for Iphone/Ipad. I have some items in the "more" of the tabbar. I want to switch to one of those views. How can i do it? Normally i would use selectedIndex, but it doesn't work on the "More" tab.


回答1:


To select view controller from more screen you should select more view controller first as it displayed in previous answer:

[tabBarController setSelectedViewController: [tabBarController moreNavigationController]]

And then perform pushViewController method for more view controller

[[tabBarController moreNavigationController] pushViewController:neededViewController animated:NO]

Or use the better way:

[tabBarController setSelectedViewController: neededViewController ]



回答2:


[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.



来源:https://stackoverflow.com/questions/15637357/how-to-switch-to-a-tabbar-item-in-the-more-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!