2

Does viewDidLoad get called when you're popping back to a UIView?

marty
  • 391
  • 1
  • 7
  • 15

1 Answers1

3

viewDidLoad gets called whenever loadView is called. loadView is called whenever the view is requested from a UIViewController and it is currently nil.

If you pop to a UIViewController and the view property is nil, loadView and hence viewDidLoad will be called. The view could be nil if it was never loaded or if it was unloaded while another view controller was on screen. It might never have been loaded if several view controllers were pushed at once.

drawnonward
  • 53,459
  • 16
  • 107
  • 112
  • Would you recommend setting a view controller's view to nil in dealloc or something? Just wondering if this was a good/bad idea. – GangstaGraham Aug 21 '13 at 14:39
  • I load my navigation items in viewDidLoad, so I need them to load everytime, since they don't persist. http://stackoverflow.com/questions/18360187/modal-view-controllers-uibarbuttonitems-do-not-persist – GangstaGraham Aug 21 '13 at 14:40