我使用自定义UINavigationController
作为rootViewController。 UINavigationController's
第一个viewController是UITabBarController
。每个UITabBarController
都是自定义UINavigationConller
。当显示tabBarController
时,我会隐藏rootViewController's
navigationBar
。
初始化
UITabbarController
+(RDVTabBarController *)tabBarControllertWithIndex:(NSUInteger)index
{
UIViewController *goodsHomeController = [[ESGoodsHomeViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *goodsHomeNavi = [[ESNavigationController alloc]
initWithRootViewController:goodsHomeController];
........
ESTabBarController *tabBarController = [[ESTabBarController alloc] init]; //对status bar 能定制
[tabBarController setViewControllers:@[goodsHomeNavi,categoryNavi,shoppingCarNavi,userCenterNavi]];
return tabBarController;
}
将其设为
navigationController
self.tabController = [UIHelper tabBarControllertWithIndex:0];
self.tableController.delegate = self;
UINavigationController *tabBarNavigation = [UIHelper navigationControllerViewController:self.tableController];
tabBarNavigation.navigationBarHidden = TRUE;
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.rootViewController = tabBarNavigation;
在baseViewController中,我自定义了navigationBar中的后退项目
- (void)setCustomNavigationBackButton
{
UIImage *backBtn = [UIImage imageNamed:@"bar_back"];
UIImage *backDownBtn = [UIImage imageNamed:@"bar_back_down"];
backBtn = [backBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
backDownBtn = [backDownBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.navigationItem.backBarButtonItem.title=@"";
self.navigationController.navigationBar.backIndicatorImage = backBtn;
self.navigationController.navigationBar.backIndicatorTransitionMaskImage = backBtn;
}
在某些情况下,在推送动画完成后推送
viewControllers
时,我会更改navigationController
的{{1}}。我使用navigationController + block
viewController
完成块后执行
- (void)popToViewController:(UIViewController *)viewController animated:(BOOL)animated onCompletion:(void(^)(void))completion
{
[CATransaction begin];
[CATransaction setCompletionBlock:completion];
[self popToViewController:viewController animated:animated];
[CATransaction commit];
}
在某些推动中,当我从 [UIHelper viewController:self pushViewController:orderDetail completion:^{
NSMutableArray *afterController = [NSMutableArray array]; //将本页面删除
NSArray *viewController = self.navigationController.viewControllers;
[viewController enumerateObjectsUsingBlock:^(UIViewController *obj, NSUInteger idx, BOOL *stop) {
if (![obj isKindOfClass:[ESPurchaseViewController class]]) {
[afterController addObject:obj];
}
}];
self.navigationController.viewControllers = afterController;
}];
推送到UITabBarController
时,我会隐藏secondViewController
并显示根navigationBar
。
navigationBar
我找不到导航无法弹出的原因。这并不总是发生。
关于+(void)tabController:(UIViewController *)tabController pushSubController:(UIViewController *)subViewController
{
[tabController.rdv_tabBarController.navigationController pushViewController:subViewController animated:YES];
tabController.rdv_tabBarController.navigationController.navigationBarHidden = FALSE;
}
,UINavigationContller
,UITabBarController
的任何关于iOS的错误基本知识让我知道吗?
谢谢!
答案 0 :(得分:1)
如果我认为你的需求是First MainNavigationViewController然后tabbar控制器与它和每个标签栏的视图控制器也有自己的nvaigation控制器然后它将正常工作..
setRotation()
检查这是否解决了您的问题先生。