.
Hi, everyone.
I have a custom ViewController(1) and presented another ViewController(2) modally.
While Modal ViewController(2) is showing, it received memory warning and changed orientation.
After then, I dismissed Modal ViewController(2).
And I checked the sequence of call back function on ViewController(1).
- willRotateToInterfaceOrientation
- loadView
- viewDidLoad
- willAnimateRotationToInterfaceOrientation
- didRotateFromInterfaceOrientation
- …
is it normal to be called willRotateToInterfaceOrientation function before loadView?
Is it normal? What does that matter? If your results are correct, willRotateToInterfaceOrientation is called first.
This is not a huge deal, however: if you need to access the view inside willRotateToInterfaceOrientation, just make sure to access
[self view]orself.viewin your code. If the view isn’t already loaded, it will be loaded right then, calling loadView and viewDidLoad as necessary before returning control back to willRotateToInterfaceOrientation.If you have outlets set up that are connected when the view loads (probable), just insert
[self view];at the top of the method to force the view to load and the outlets will be connected when it returns. Then you can callself.bigButton.enabled = NO;or whatever else you’d like to do.