I want to know the sequence in which default or predefined methods ( such as viewDidLoad applicationDidFinishLaunching etc) are called in program execution in a navigation based application.
Asked
Active
Viewed 159 times
1 Answers
1
See a life cycle for a view controller
- init
- loadView (if view wasn't specified with initWithNibName)
- viewDidLoad
- viewWillAppear
- viewDidAppear
- //here come some actions
- viewWillDisappear
- viewDidDisappear
- viewDidUnload (in case of memory warnings)
Everything else depends on the sequence and methods (IB or through code) of instantiating of root view controllers.

knuku
- 6,082
- 1
- 35
- 43
-
where in this sequence, applicationDidFinishLaunching or applicationDidFinishLaunchingWithOptions are executed? Also what will happen if I implement both the methods? – Nitesh Sep 27 '10 at 17:27
-
1note that `viewDidUnload` won't always be called. It will be called in case the view is destroyed before the view controller (for example if the navigation controller gets a memory warning), but it won't be called when the view controller itself is dealloc'ed (for example if you tap back on your navigation controller, the view controller will get `viewDidDisappear` -> `dealloc`, no `viewDidUnload`). – filipe Dec 17 '10 at 14:53