• 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: creating custom views in IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating custom views in IB


  • Subject: Re: creating custom views in IB
  • From: Henri Lamiraux <email@hidden>
  • Date: Fri, 3 Aug 2001 10:09:22 -0700

Do not rely on -initWithFrame: being called when unarchiving objects from a nib. The right way to do any post nib loading initialization is to implemement -awakeFromNib.

If you subclass an object in IB the -initWithCoder: method will be called not the -initWithFrame;
If you use a Custom View, then yes your -initWithFrame: will be called (because in fact the -initWithCoder: method of NSCustonView is called and then your custom view is allocated using [[<yourClass> alloc] initWithFrame:theFrame].

BUT at initWithXXXX time non of the outlets and actions have been set up yet so if you override -initWithCoder: (or -initWithFrame: for custom views) and your init routine expects outlets to be set they wont. When -awakeFromNib is called you are sure that your object has been fully unarchived.

On Friday, August 3, 2001, at 09:39 AM, Alex Golovinsky wrote:

I override the initWithFrame method to change some of my class variables.

Henri Lamiraux
Engineering Manager
User Interface Tools Group
Apple


  • Prev by Date: International strings
  • Next by Date: Re: Need Help with Help
  • Previous by thread: Re: creating custom views in IB
  • Next by thread: NSImage questions from a newbie
  • Index(es):
    • Date
    • Thread