objective c – Modal view controllers calling other’s “viewDidLoad” – Education Career Blog

I have a bunch of pages I am chaining together and presenting as modal view controllers. THey all have viewDidLoad methods. It seems that when one is loaded though it calls the viewDidLoad methods of ones in the background too. How can I stop this? Thanks!


You can’t. The viewDidLoad method will get called when the view is loaded. Asking a view controller for its view loads the view.

Consider moving code into your viewWillAppear:(BOOL)animated method. That way it will only get called before the view is actually shown to the user.

Leave a Comment