我想在 .tabbaritem 的特定索引处获取UIViewControllers
ie堆栈列表。请详细说明..!请大伙牵手UINavigationController
UITabBarController
问问题
371 次
2 回答
1
如果您想在选项卡更改时检查这一点,请实现UITabBarControllerDelegate的回调:
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
//if you're using navigationController
UINavigationController *navC=(UINavigationController *)viewController;
NSArray *arrayVc=navC.viewControllers;
NSLog(@"%@",arrayVc);
}
于 2012-11-01T12:51:46.010 回答
1
做这个:
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
}
}
于 2012-11-01T12:51:56.980 回答