开发者

Method to load a tab bar item?

I have 2 tab bar items. The first tab have a navigation controller(3 views) within.

Say I am on the 3rd vie开发者_Go百科w of the navigation controller, how do I load the 2nd tab.


So you want to switch from the first tab to the second tab. Well you first you need to acces the tabbarController. Most of the time you would have the tabbar controller in AppDelegete. Calling the delegate like this:

MyAppDelegate *delegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];

Then the just set the selectIndex:

[delegate.tabBarController setSelectedIndex:1];

or

[delegate.tabBarController setSelectedViewController:self.secondViewController];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜