Re: -viewDidUnload not always called?
Re: -viewDidUnload not always called?
- Subject: Re: -viewDidUnload not always called?
- From: Rick Mann <email@hidden>
- Date: Thu, 13 Oct 2011 10:37:15 -0700
On Oct 13, 2011, at 8:02 , Fritz Anderson wrote:
> On 12 Oct 2011, at 5:39 PM, Rick Mann wrote:
>
>> I can't tell from the docs for -viewDidUnload if it is not guaranteed to be called when cleaning up. It does say that it's called for low-memory situations, but also says it's called as a counterpart to -viewDidLoad, which is always called when a view controller is created.
>
> The docs say specifically:
>> When a low-memory condition occurs and the current view controller’s views are not needed, the system may opt to remove those views from memory.
>
> It doesn't refer to any other scenario, and given that the recommendation is that -viewDidUnload do many of the same releases (+ plus nil-outs) as would be done in -dealloc, I take it that low-memory (and therefore -viewDidUnload) and deallocation are separate paths.
Except it does say "called as a counterpart to -viewDidLoad", implying a symmetry between those two. Moreover, it just "makes sense" (to me, anyway), that for every call to -viewDidLoad, you'd also get a (single) call to -viewDidUnload.
You're right, however, that the requirement to release views in -dealloc, too, would be redundant if the symmetry were preserved.
It's less elegant this way, for sure. And I don't think it can guarantee that -viewDidUnload AND -dealloc won't both be called.
--
Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden