Re: Accessing interface elements (iPhone vs Mac)
Re: Accessing interface elements (iPhone vs Mac)
- Subject: Re: Accessing interface elements (iPhone vs Mac)
- From: Graham Cox <email@hidden>
- Date: Wed, 21 Jan 2009 12:30:23 +1100
On 21 Jan 2009, at 7:41 am, Ashley Perrien wrote:
I believe I've tried it and the property and synthesize are not
NECESSARY for it all to work; so is having it in there of some kind
of benefit for the iPhone or is it just a quirk of how developer X
likes to do things? I've seen some discussions about how the
autorelease pool shouldn't be used as much on the iPhone and ideally
you should alloc and then later release things for tighter memory
control. That makes sense. Is there something similar with the
above, is there a back-end reason to property, synthesize and
release things that were created in IB?
I'm not developing on the iPhone, so I might have this wrong, but I
think the reason is that whereas on the Mac IBOutlets are inherently
retained, on the iPhone they are not, to help promote as early a
release as possible. Thus to make sure the outlets do get retained,
the outlet has an associated property that retains. When the nib is
loaded, the accessor is used rather than setting the ivar directly (as
per Mac), but on the iPhone the accessor is responsible for retaining
the value. In fact this is cleaner and more consistent than the Mac
way, where the retention of IBOutlet ivars is an exception to normal
memory management rules. I guess apart from potentially being more
memory efficient, Apple took the opportunity with the iPhone version
of the OS to fix this anomaly.
If I'm way off here no doubt someone will correct me ;-)
--Graham
_______________________________________________
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