UIViewController lifecycle: viewDidLoad, viewWillDisappear

 

 

 

 

 

This is useful:

UIViewController_lifecyclehttp://www.snowcrash.eu/wp-content/uploads/2013/04/UIViewController_lifecycle.gif-588x536.jpeg 588w, http://www.snowcrash.eu/wp-content/uploads/2013/04/UIViewController_lifecycle.gif.jpeg 690w" sizes="(max-width: 300px) 100vw, 300px" />

 

How does this fit in with other view controllers though?

Given View Controller A and View Controller B.

View Controller A is about to appear and View Controller B is about to disappear.

viewDidLoad is called on A first.

THEN

viewWillDisappear is called on B.

In other words, viewDidLoad is called on the View Controller about to appear, A, (even though it hasn’t appeared yet – i.e. viewDidLoad just means it has been loaded into memory) and then viewWillDisappear is called on the¬†View Controller, B, that is about to disappear.

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *