UINavigationView无法弹出,只有导航弹出动画,UIViewController没有改变

时间:2015-09-07 03:39:51

标签: ios objective-c uinavigationcontroller uitabbarcontroller

我使用自定义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; } UINavigationContllerUITabBarController的任何关于iOS的错误基本知识让我知道吗? 谢谢!

1 个答案:

答案 0 :(得分:1)

如果我认为你的需求是First MainNavigationViewController然后tabbar控制器与它和每个标签栏的视图控制器也有自己的nvaigation控制器然后它将正常工作..

setRotation()

检查这是否解决了您的问题先生。