我需要獲取UIViewControllers
的列表,比如UINavigationController
在指定的 UITabBarController
中tabbaritem
的索引。請幫忙~
這個:
NSArray *arrControllers = self.tabBarController.viewControllers;
for(UIViewController *viewController in arrControllers)
{
if([viewController isKIndOfClass:[UINavigationController class]])
{
//NavigationController
UINavigationController *navCtrl = (UINavigationController *)viewController;
NSLog(@"%@",navCtrl.viewControllers);
}
else
{
// view controller
}
}