Search code examples
iosuiviewcontrollerloadview

if a view controller got unloaded due to low memory pressure, will loadView be called again once it's is about to be shown again?


I understand that the viewDidUnload will be called when the app is under low memory pressure, then when the related view/controller is about to be "active" again, will the loadView be called?


Solution

  • Yes it will. Check out the Understanding How Views are Loaded and Unloaded section of the iOS View Controller programming guide to see a flow chart of how this works. The documentation for -loadView also notes that this method will be called when the view property is accessed, but is currently nil.