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: Mon, 17 Nov 2008 23:04:34 -0500
On Nov 17, 2008, at 10:53 PM, Luke the Hiesterman wrote:
On Nov 17, 2008, at 7:46 PM, Brian Stern wrote:
On Nov 17, 2008, at 10:17 PM, Luke the Hiesterman wrote:
On Nov 17, 2008, at 7:12 PM, Brian Stern wrote:
OK, this issue has come up for me very recently. It appears that
on iPhoneOS IBOutlets are retained, regardless of the presence of
properties. Even worse, in the presence of an assign property
the outlet is still retained. Whatever code is retaining the
outlets never releases them. So it seems that client code must
release all outlets.
Seems to me that the outlets must have a retain count of at least
one when they're unarchived, as though they were alloc'd. It makes
sense that the programmer should have to manually release objects
in dealloc. How else would it happen?
IBOutlets are not necessarily top level objects. Most are simply
views that happen to be in the view hierarchy. There will
typically be one top level object in an iPhone nib. This will be
the view that belongs to UIViewController. It is the
UIViewController base class that loads the nib. As long as it
retains that top level view then all the subviews will also be
retained. They should be released when the UIViewController
releases its view outlet.
Right, and view is a property of UIViewController. When you have
your UIViewController release view, that is an example of the
programmer releasing an outlet assigned from IB, which you seem to
be arguing that the programmer shouldn't have to release objects
given to it from IB.
Top. Level. Object.
Whatever code loads the nib is the owner of the array of top level
objects and should retain them. That object is UIViewController, not
my subclass.
At any rate. The problem is that this is poorly documented.
--
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