• 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
Re: init vs awakefromnib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >init vs awakefromnib (From: "Ahmet Taha Sakar" <email@hidden>)

  • Prev by Date: Re: Need help with setNeedsDisplay - Another Update
  • Next by Date: Re: Framework project config & accessing resources in the framework bundle.
  • Previous by thread: Re: init vs awakefromnib
  • Next by thread: Re: init vs awakefromnib
  • Index(es):
    • Date
    • Thread