开发者

why is viewdidunload function not called when i click back button on navigation based app

开发者 https://www.devze.com 2023-02-15 06:50 出处:网络
Hi I want to release my fetchedResults开发者_开发问答Controller. I was wondering why is viewdidunload not called when i push back button on navigation based application.or i should release it somewhe

Hi I want to release my fetchedResults开发者_开发问答Controller.

I was wondering why is viewdidunload not called when i push back button on navigation based application.or i should release it somewhere else?

thanks for help


-viewDidUnload is only guaranteed to be called when the view is purged from memory, and the UIKit framework might be hanging on to it in order to present the view quickly if the user goes back there. To deterministically release your fetched result controller when the view disappears, use -viewWillDisappear: or -viewDidDisappear:.


If you think that you're having leaks because viewDidLoad isn't called, than check your controller.view removeFromSuperView calls and ensure that you're using removeFromParentViewController. Instead of just removing the view from superview remove your viewController from its parentController.


I'm seeing something strange happening in my case: dealloc is called but viewDidUnload don't.

But I think I can live with that for memory management purposes because all my strong properties will be deallocated at that time (I'm using ARC).

In your case I think you should check also for dealloc being called and release your fetchedResultsController there.


you can call it yourself from -dealloc.

0

精彩评论

暂无评论...
验证码 换一张
取 消