• 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: app delegate +initialize
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: app delegate +initialize


  • Subject: Re: app delegate +initialize
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 23 Sep 2009 08:26:58 -0700

Does your class have a subclass, which also has a +initialize method, which doesn't call [super initialize]? That might cause this sort of behavior, because the order in which the classes load may be indeterministic.

In general, you cannot predict the order in which objects/classes are initialized in a nib. Down inside AppKit there's a dictionary enumeration going on, and the ordering is undefined; in practice, it depends on the hashcodes of the objects, which are usually their memory addresses, which are not predictable...

This is why it's best to do your initialization in an -awakeFromNib method, which won't be called until all the objects have been instantiated. (Of course the order of the -awakeFromNib calls is still random, but in practice that isn't usually a problem.)

—Jens_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: app delegate +initialize
      • From: Dave Keck <email@hidden>
References: 
 >app delegate +initialize (From: John Baldwin <email@hidden>)
 >Re: app delegate +initialize (From: Dave Keck <email@hidden>)

  • Prev by Date: Multiline label allignment issue.
  • Next by Date: Re: Multiline label allignment issue.
  • Previous by thread: Re: app delegate +initialize
  • Next by thread: Re: app delegate +initialize
  • Index(es):
    • Date
    • Thread