UITabBarController *tabBarCtr = [[UITabBarController alloc]init];
SecondViewController *secondViewCtrl1=[[SecondViewController alloc]init];
UINavigationController *navCtrl1=[[UINavigationController alloc]initWithRootViewController:secondViewCtrl1];
[secondViewCtrl1 release];
TabBarViewController *secondViewCtrl2=[[TabBarViewController alloc]init];
UINavigationController *navCtrl2=[[UINavigationController alloc]initWithRootViewController:secondViewCtrl2];
[secondViewCtrl2 release];
NSArray *array=[NSArray arrayWithObjects:navCtrl1,navCtrl2,nil];
tabBarCtr.viewControllers=array;
[self presentModalViewController:tabBarCtr animated:YES];
本文展示了一个使用UITabBarController创建导航控制器的例子。通过初始化UITabBarController和两个UINavigationController,并设置其根视图控制器为SecondViewController和TabBarViewController,最后将它们添加到UITabBarController的viewControllers数组中。

84

被折叠的 条评论
为什么被折叠?



