• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
init vs awakefromnib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: init vs awakefromnib
      • From: Mark Ritchie <email@hidden>
    • Re: init vs awakefromnib
      • From: Chris Hanson <email@hidden>
    • Re: init vs awakefromnib
      • From: Keith Duncan <email@hidden>
  • Prev by Date: Re: Need help with setNeedsDisplay - Another Update
  • Next by Date: Re: init vs awakefromnib
  • Previous by thread: Re: Need help with setNeedsDisplay - Another Update
  • Next by thread: Re: init vs awakefromnib
  • Index(es):
    • Date
    • Thread