2014-09-27 39 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