Re: Should I retain/release IBOutlet?
Re: Should I retain/release IBOutlet?
- Subject: Re: Should I retain/release IBOutlet?
- From: Lon Giese <email@hidden>
- Date: Sat, 13 May 2006 18:06:39 -0700
Im sure someone will argue with my answer but that's ok... Only top
level objects in the Nib need to be released by you.. those are all the
objects in the little window that contains 'File's Owner'. all other
objects in a nib will be released automatically... for example any
buttons you put in a window will be released by the window when it is
deallocated. Now I never release the main menu even though it is a top
level object, this is probably not stylistically correct but I never
have any problem with it, since the main menu normally stays in
existence throughout the application's life... Whatever object
(usually File's Owner) that created the nib should release the top
level objects in it... I strongly suggest using the document
architecture because it automates many various tasks into a really nice
way of managing nibs, window controllers and documents... It doesn't
really matter if the object is connected to an IBOutlet or not, but I
might be wrong about that I don't know everything about nibs yet...
There are funny things that happen (and not very well documented) when
you connect outlets between two different Nibs...
On May 13, 2006, at 2:47 PM, Eric wrote:
In most of the code I've seen (and wrote), I don't ever retain nor
release
IBOutlet ivars. I just assume they will be allocated and deallocated
with
the object itself along with the nib that contains them. Is there any
situation where I would want to manually retain / release IBOutlet
within my
class? For example, if some other object (outside of the NIB) retains
the
object containing the IBOutlet.
thanks,
eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden