UITabBarController的viewWillAppear总是执行两次

时间:2018-03-05 03:44:50

标签: ios objective-c uitabbarcontroller

当我与第三方成功登录然后跳转到UITabBarController时,UITabBarController的viewWillAppear总是执行两次。

这是跳转到UITabBarController的代码。 TTabBarVC继承自UITabBarController。

TTabBarVC *vc = [TTabBarVC new];
KLNavigationController *nc = [[KLNavigationController alloc] initWithRootViewController:vc];
UIViewController *oldRootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
[UIView transitionFromView:oldRootVC.view toView:nc.view duration:.3f options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionTransitionCrossDissolve completion:^(BOOL finished) {
    [UIApplication sharedApplication].keyWindow.rootViewController = nc;
}];

0 个答案:

没有答案