iPhone UINavigation Issue - nested push animation can result in corrupted navigation bar

后端 未结 20 1894
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 20:14

I keep getting the following errors:

2011-04-02 14:55:23.350 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55         


        
相关标签:
20条回答
  • 2020-11-30 20:45

    I had this error message too, and the navigation bar and navigation controller transitions were weird. My setup was a bunch of Navigation Controllers embedded in a Tab bar Controller. The problem was that I didn't call super.viewDidLoad() in my Tab bar Controller implementation of viewDidLoad.

    Calling super is something the docs clearly point out that you should do when overriding viewDidLoad, and I learned this the hard way.

    Maybe this can help someone else too!

    0 讨论(0)
  • 2020-11-30 20:48

    I've figured it out. Apparently if you call -pushViewController from outside of the -didSelectRowAtIndexPath method of a UITableViewDelegate, it doesn't work. Moving the call into that function worked. Weird.

    0 讨论(0)
  • 2020-11-30 20:48

    This was happening for me because of my UIControlEvents

        [button addTarget:self action:@selector(callSecondView) forControlEvents:UIControlEventAllTouchEvents];
    

    I had to change the UIControlEventAllTouchEvents to UIControlEventTouchUpInside or however you want your button to work if you had the issue because of a UIButton call.

    0 讨论(0)
  • 2020-11-30 20:51

    This resolves the problem: https://github.com/nexuspod/SafeTransition

    If you push (or pop) a view controller with animation(animated:YES) it doesn't complete right away, and bad things happen if you do another push or pop before the animation completes.

    To reproduce this bug, try pushing or popping two view controllers at the same time. Example:

    - (void)viewWillAppear:(BOOL)animated
    {
        [super viewWillAppear:animated];
        UIViewController *vc = [[UIViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
    

    You will receive this error:

    2014-07-03 11:54:25.051 Demo[2840:60b] nested push animation can result in corrupted navigation bar 2014-07-03 11:54:25.406 Demo[2840:60b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

    Just add the code files into your project and makes your navigation controller as a subclass of APBaseNavigationController, and you'll be good to do.

    0 讨论(0)
  • 2020-11-30 20:52

    What do you mean when you say you use init methods instead of viewDidLoad methods?

    If you're pushing a new view controller before the old push has bad a chance to be actioned, you will get this sort of error. So putting certain code into init and doing things prematurely could certainly get you the error being reported.

    At the point where init is being run on a view controller, the view hasn't been loaded yet!

    0 讨论(0)
  • 2020-11-30 20:52

    Just to complete the list, here is another reason which can cause "nested push animation can result in corrupted navigation bar":

    I did setup several NavigationController within a TabBarController and set the selectedIndex within the storyboard Identifiy Properties. After moving active Tab to Code error disappeared.

    0 讨论(0)
提交回复
热议问题