ViewDidUnload is not being called for viewControllers inside UIscrollView

268 Views Asked by At

I have this hierarchy:

MainViewController -> Sub View Controller -> UIScrollViewController -> Several (4) ViewControllers.

When I get out from the Sub View Controller I want that the ViewController inside the UIScrollView will call their ViewDidUnload so I will be able close some processes.

What is the right way to achieve that, I have to say that I am targeting iOS 4.1 and above.

Thanks Shani

2

There are 2 best solutions below

0
On

Behavior is a bit different between iOS 4 and iOS 5. See here for details. Are you explicitly removing the views from the hierarchy?

0
On

From the UIViewController class reference:

On iOS 6, views are never purged and viewWillUnload and viewDidUnload are never called. If your view controller needs to perform specific tasks when memory is low, it should override the didReceiveMemoryWarning method.