UITabBarController UINavigationController 相结合代码

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 UINavigationController 相结合代码)