2012-08-21

iOS: nested push animation can result in corrupted navigation bar


Today I got a very strange error by running an iOS App:

1. nested push animation can result in corrupted navigation bar
2. Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

It happens when the view controller tries to pop to top view controller without waiting for the loading end of child view controller.

Solution:

1. try to set a boolean variable to mark the view controller should pop to the top view controller
2. in viewDidAppear:(BOOL)animated method, check if a call of [self.navigationController popToRootViewControllerAnimated:YES] is needed

The reason:

popToRootViewControllerAnimated() must be called after the view appears!

1 comment:

city said...

thanks for sharing..