We can categorized iOS life cycle mainly in two category:
1) The App launch cycle
2) View Controller life cycle
The launch cycle states different app states in which an iOS app can transit in its life . The different app states are as:
1) Not running
2) Inactive
3) Active
4) Background
5) Suspended
When an app goes from one states to another it is called app delegate methods. These methods provides a way to take appropriate action on app state changes. These methods are as:
application:didFinishLaunchingWithOption: called when app launches first time.
applicationDidBecomeActive: called after app enters in foreground.
applicationWillResignActive: called before an app enters in background.
applicationDidEnterBackground: called after app enters in background. In this state an app may be suspended at any time.
applicationWillEnterForeground:called when app changes state from background to foreground. But app is not yet active
applicationWillTerminated: This method is not called when an app is suspended or user terminated the app explicitly.
View Controller life cycle:
viewDidLoad: called only once during initial load of the interface.
1) The App launch cycle
2) View Controller life cycle
The launch cycle states different app states in which an iOS app can transit in its life . The different app states are as:
1) Not running
2) Inactive
3) Active
4) Background
5) Suspended
When an app goes from one states to another it is called app delegate methods. These methods provides a way to take appropriate action on app state changes. These methods are as:
application:didFinishLaunchingWithOption: called when app launches first time.
applicationDidBecomeActive: called after app enters in foreground.
applicationWillResignActive: called before an app enters in background.
applicationDidEnterBackground: called after app enters in background. In this state an app may be suspended at any time.
applicationWillEnterForeground:called when app changes state from background to foreground. But app is not yet active
applicationWillTerminated: This method is not called when an app is suspended or user terminated the app explicitly.
View Controller life cycle:
viewDidLoad: called only once during initial load of the interface.
viewWillAppear:This method is called just before views appears or renders on screen every time when you navigate or switch between different views.
viewDidAppear: called when views completely. Here we can handle UI or functionalities.
viewWillDisappear: called before view is removed or any animation is configured.
viewDidDisappear:called when view is removed.
No comments:
Post a Comment