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: Jonathan Hess <email@hidden>
- Date: Mon, 17 Nov 2008 22:03:37 -0800
On Nov 18, 2008, at 12:49 AM, Brian Stern wrote:
On Nov 18, 2008, at 12:35 AM, Jonathan Hess wrote:
Perhaps the new @property() syntax makes it easy to forget about
object lifetimes because it does the set/get/change
automagically. These days when I add any property I go right to
the dealloc method (and init if I have one) and ensure I've
managed that property before I forget.
Yes, but this is exactly the point. If I have no property for an
Outlet it's still retained.
Hey Brian -
Outlets for iPhone OS are established by calling
setValue:forKeyPath:. The behavior of setValue:forKeyPath: is that
if a setter exists, it is called. If a setter does not exist, the
instance variable is looked up and set directly, and if it is an
object, it is retained. This means that for IBOutlets, with no
setters, they're retained in iPhone OS. This is different from Mac
OS X. If you're writing code on both platforms, or are planning to,
you should always use properties on both platforms since it makes
the decision to retain outlets explicit and obvious.
How come the documentation that mmalc quoted doesn't have this clear
statement?
Hey Brian -
Check out "Table 2-1". It states all of this explicitly.
Jon Hess
Jon Hess
--
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
_______________________________________________
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