I suspect that some cleanup code that is called when my main view disappears will interfere with the initialization code in my detailed view. I checked Apple’s documentation, but I couldn’t find any that involved multiple View controller information.
> Master prepareForSegue:
>Detail viewDidLoad
> Master viewWillDisappear:
>Detail viewWillAppear:
>Display the new view (with or without animation)
> Master viewDidDisappear: (after the animation ends)
>Detail viewDidAppear:
However, when using UITabViewController to switch between views, the order is Different:
> SecondTab viewDidLoad
> SecondTab viewWillAppear:
> FirstTab viewWillDisappear:
>The new view will be displayed.
> FirstTab viewDidDisappear:
> SecondTab viewDidAppear:
So it seems that you cannot always rely on these events occurring in the same order-it may vary depending on the nature of the view controller you are transitioning.
Are there any important points missing here?
When I transition from one view controller (let’s call it MasterViewController) to another view controller (called DetailViewController), the viewWillDisappear:, viewWillAppear: What is the order of calling the other methods?
I suspect that some cleanup code that is called when my main view disappears will interfere with the initialization code in my detailed view. I checked Apple’s documentation, but I couldn’t find any that involved multiple View controller information.
I created a simple UINavigationController-based project and added some NSLog statements to find out the order in which they are called.
> Master prepareForSegue:
>Detail viewDidLoad
> Master viewWillDisappear:
>Detail viewWillAppear:
>Display new view (with or without animation)< br>> Master viewDidDisappear: (after the animation ends)
>Detail viewDidAppear:
However, when using UITabViewController to switch between views, the order is different:
> SecondTab viewDidLoad
> SecondTab viewWillAppear:
> FirstTab viewWillDisappear:
>The new view will be displayed.
> FirstTab viewDidDisappear:
> SecondTab viewDidAppear:
So it seems you can’t Always rely on these events occurring in the same order-it may vary depending on the nature of the view controller you are transitioning.
Am I missing any important points here?