加载标签栏项的方法?

时间:2011-08-05 08:12:26

标签: iphone xcode tabs navigation

我有2个标签栏项目。第一个选项卡中有一个导航控制器(3个视图)。

假设我在导航控制器的第3个视图中,如何加载第2个选项卡。

1 个答案:

答案 0 :(得分:1)

所以你想要从第一个标签切换到第二个标签。 那你首先需要访问tabbarController。 大多数情况下,你会在AppDelegete中使用tabbar控制器。 像这样召集代表:

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

然后只需设置selectIndex:

[delegate.tabBarController setSelectedIndex:1];

[delegate.tabBarController setSelectedViewController:self.secondViewController];