I was doing some testing and debugging of my Iphone app today and encountered some strange behaviour.
In my MainView
I have two modal views and when showing one of these using presentModalViewController
I noted that the viewDidUnload
method of my MainView
was called while it was not happening when showing the other. It was the same case for the viewDidLoad
method (of MainView
) while closing the subviews.
I inspected the two methods for opening and closing the subviews and the only difference I found was in the modalTransitionStyle
. In the one which did activate viewDidUnload
/viewDidLoad
I was using UIModalTransitionStyleFlipHorizontal
and in the other UIModalTransitionStyleCrossDissolve
. I then started experimenting by swapping the two styles and by using the other transition styles as well and I found that this was indeed what was causing the different behaviour. In fact when using UIModalTransitionStyleFlipHorizontal
the viewDidUnload
/viewDidLoad
methods of the "parent" view controller were always called while it never happened for any of the other transition styles.
My question is now it this is supposed to behave like this, and if not which behaviour is then the correct one. Are the unload and load methods supposed to get called when showing and closing an modal view or not.
Also, could someone else confirm or disconfirm this behaviour?
Thanx
PS. the viewDidLoad
method of the two called view controllers gets called every time. Just to clarify :)