I have 2 tabs, one that contains the imagepicker controller, and another that contains a UItableView as a subview to a uiview controller.
I realise that when I call the imagepicker controller (SourceTypeCamera), my page in the other tab is being unloaded (‘view didUnload’ method) is triggered.
Is this a normal behaviour I should expect? (that other tab’s views get unloaded) Or is it due to some memory issue when using the camera which I should take care off?
As you say,
viewDidUnloadcan be triggered at any time, and is normally associated with a low memory warning, a view controller’s view otherwise being cached even when not needed for as long as memory will allow. So in a strict sense it’s neither expected nor unexpected, as it depends on the sum total state of the rest of the system.That being said,
UIImagePickerControlleris famously quite memory hungry when capturing an image (see e.g. this image, where each spike is related to an instance of UIImagePickerController “capturing an image” per the related blog), so other views being forced from memory shouldn’t be so surprising.There’s no documented mechanism and no reason for a
UIImagePickerto force other controllers to dump their views speculatively.