init vs awakefromnib
init vs awakefromnib
- Subject: init vs awakefromnib
- From: "Ahmet Taha Sakar" <email@hidden>
- Date: Sat, 10 Mar 2007 15:44:45 -0800
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.
So these are my questions:
1) Why does the location of alloc and initilizaing a class variable code
make this difference?
2) Arent all class variables automaticaly retained until the whole class is
released?
3) What's the way to allocate and initialize the class variable in init
method of the class to be able to use it with other methods later. I have
tried adding retain, but it hasnt worked.
Thanks
_______________________________________________
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