UITabBarController UINavigationController 相结合代码

来源:互联网 发布:韩国悬疑片 知乎 编辑:程序博客网 时间:2024/05/19 02:01

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];

原创粉丝点击