Reputation: 15344
When I transition from one view controller (let's call it MasterViewController
) to another (called DetailViewController
), in what order are the viewWillDisappear:
, viewWillAppear:
, etc. methods on each controller called?
I suspect some of the cleanup code called when my master view disappears is interfering with the initialization code in my detail view. I've looked through Apple's documentation but can't find any information involving multiple view controllers like this.
Upvotes: 3
Views: 1740
Reputation: 15344
I created a simple UINavigationController-based project and added some NSLog
statements to find out what order they get called in.
prepareForSegue:
viewDidLoad
viewWillDisappear:
viewWillAppear:
viewDidDisappear:
(after animation is finished) viewDidAppear:
However, when switching between views using a UITabViewController
, the order is different:
viewDidLoad
viewWillAppear:
viewWillDisappear:
viewDidDisappear:
viewDidAppear:
So it seems that you cannot always count on these events occuring in the same order - it can vary depending on the nature of the view controllers you are transitioning between.
Are there any important points that I missed here?
Upvotes: 9