Re: init vs awakefromnib
Re: init vs awakefromnib
- Subject: Re: init vs awakefromnib
- From: Chris Hanson <email@hidden>
- Date: Sat, 10 Mar 2007 22:41:36 -0800
On Mar 10, 2007, at 3:44 PM, Ahmet Taha Sakar wrote:
I have a NSWindowController subclass. In this class I have created a
NSMutableArray class variable. If I alloc and init this variable in
init
method of the class it gets released after awakefromnib and
therefore I can
not use it later. However if I alloc and init the variable in
awakeFromNib,
it gets retained as I wanted and I can use it later.
It sounds like you really mean "instance variable." A "class
variable" is a variable that is part of the class itself, not
instances of the class.
In any case, it sounds like your NSWindowController subclass is
instantiated in a nib file, and also in your code, and you're
expecting an instance variable that's part of one instance to be
available to the other. Pick one place or the other and instantiate
your NSWindowController subclass there.
-- Chris
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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