search by tags

for the user

adventures into the land of the command line

iOS view controller life cycle methods

below is the sequence of loading or unloading methods called when a view controller is added or removed from the view controller stack.

this first one is only with Objective C, swift also has it but the technique to use it is different


if you are using storyboards

func awakefromNib()

if you are generating the view contoller from code

func loadView()

the next one is called only once in the life cycle of viewController, once it has been added to the stack

func viewDidLoad()

while moving to a new ViewController

func viewWillAppear()
func viewDidAppear()

and what happens to the old ViewController that was moved away from

func viewWillDisappear()
func viewDidDisappear()