2014-09-27 44 views
0
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:  (UIViewController *)viewController{ 
    if (viewController == _personalNavViewCtrl) { 
    AppDelegate *delegate = (AppDelegate*)[UIApplication sharedApplication].delegate; 
    if (delegate.uid == nil) {//账户没有登陆过 
     if (_loginViewCtrl == nil) { 
      _loginViewCtrl = [[LoginViewCtrl alloc] init]; 
     } 
     NSLog(@"_personalNavViewCtrl.ViewCtrl:%@",_personalNavViewCtrl.viewControllers); 
     if (_personalNavViewCtrl.topViewController != _loginViewCtrl) { 
      [_personalNavViewCtrl pushViewController:_loginViewCtrl animated:NO]; 
     } 
    } 
} 
} 

上述导航嵌套的推动是关键code.the代码有UITabBarController,一个UINavigationController是它,它的产品4.当我触摸ITEM4,我想通过一些推另一UIViewController预审法官。所以当目前的项目是3时,当我触摸item4时,就没关系。但是当目前的项目是4时,我再次触摸item4,我发现了这个问题。我发现UINavigationControllerviewControllers只是rootViewController,我推送的一个被解散。另一个:日志告诉我:1,嵌套的推动动画可能导致导航栏2损坏,完成导航过渡处于意外状态。子视图树可能会损坏。造成的TabBar触摸

我不知道为什么。

回答

0

方法1:

使用

- (void)presentViewController:(UIViewController *)viewControllerToPresent 
        animated:(BOOL)flag 
        completion:(void (^)(void))completion 

出示您的_loginViewCtrl

方法2:

测试中

- (BOOL)tabBarController:(UITabBarController *)tabBarController 
shouldSelectViewController:(UIViewController *)viewController 
+0

是否logined谢谢你,但我婉要知道问题发生的原因 – huixing 2014-09-27 10:42:47