Life cycle of each view controller important methods (Swift) (Important Methods during the Lifecycle of a View Controller) ...

1. init(coder:)

It is the view controller to create an instance of the default initialization function from storyboard.
(It is the initializer for UIViewController instances created from a storyboard.)

It is called only once in the entire life cycle.

 

2. init(nibName:bundle:)

It is specified view controller initialization function.

(It is the designated initializer for UIViewController.)

When the instance is not to create a view controller through the storyboards, the method is called.

It is called only once in the entire life cycle.

 

3. loadView()

This method is used to override the program so as to create a view of a view controller.

 

4. viewDidLoad()

This method is used to override configured to interface file (XIB) file loadable view.

This method is called after the view create view controller.
 
5. viewWillAppear(_:)
This rewrite method is used to configure the interface to view the file (XIB) loadable files (ibid.).
This method is called repeatedly multiple times, each view controller's view to re-appear on the screen when they were called.
 
6. viewWillDisappear(_:)
    viewDidDisappear(_:)
Both method calls in the view controller's view off the screen every time.
 
 

Reproduced in: https: //www.cnblogs.com/davidgu/p/5798310.html

Guess you like

Origin blog.csdn.net/weixin_34148508/article/details/93803087