Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
- Subject: Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
- From: Brian Stern <email@hidden>
- Date: Tue, 18 Nov 2008 00:06:10 -0500
On Nov 17, 2008, at 11:58 PM, mmalcolm crawford wrote:
On Nov 17, 2008, at 8:34 PM, Brian Stern wrote:
Don't you find it odd that you need to release outlets in
didReceiveMemoryWarning?
Not at all -- assuming that you have a reference -- strong or weak
-- to an item in the user interface, you want to make sure you break
it if the view is supposed to disappear.
If you have a strong reference you want to make sure that the item
is disposed of when the other items from the nib go away; if you
have a weak reference you want to make sure you don't send a message
to a deallocated object (it'll go when the view goes...).
UIViewController isn't guaranteed to release the view. It only does
this if the view isn't visible, based on its own heuristics. My
subclass has no real way to know if the view will be released or not.
If I release the outlets in viewDidLoad then I don't have this
problem. My code has no interest in maintaining a strong reference to
its outlets. The view hierarchy can do that just fine.
--
Brian Stern
email@hidden
_______________________________________________
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