• 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: IB Palettes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IB Palettes?


  • Subject: Re: IB Palettes?
  • From: Rick Mann <email@hidden>
  • Date: Thu, 22 Nov 2007 13:32:37 -0800


On Nov 22, 2007, at 1:16 PM, Jonathan Hess wrote:

In Interface Builder you can specify that any instance can be of a different more derived type at runtime. To do this use the identity inspector (command + 6) and use the custom class combo box to type in a new class name. At runtime, an instance of that class will be instantiated in place of the selected object.

So, if you subclassed NSView, drag an NSCustomView to your document. If you subclassed something more specific like an NSButton, drag an NSButton to your document. Once you've done that select the instance and use the identity inspector to change the class to your custom subclass. When you load your nib at runtime an instance of your custom class will be instantiated instead of the button.

Thanks.

So, that's the second technique described by "View Programming Guide for Cocoa." It says:

The second technique is to specify a custom class is used when your custom view subclass inherits
from a view that Interface Builder provides support for directly. For example, you can create an
NSScrollView instance in Interface Builder and specify that a custom subclass (MyScrollView) should
be used instead, again using the inspector. In this case, when the nib file is loaded by the application,
the view instance has already been created and the MyScrollView implementation of initWithFrame:
is never called. The MyScrollView instance receives an awakeFromNib message and can configure
itself accordingly.

The problem here is that, I don't see how my initWithFrame: could ever get called. IB needs to call that before archiving the view, and it doesn't have the ability to call it.


Even if I had a custom palette for it, I don't see how it could call it, but the phrase "If you have not created an Interface Builder palette" implies that there is a way to create a palette.

--
Rick

_______________________________________________

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: IB Palettes?
      • From: Jon Hess <email@hidden>
    • Re: IB Palettes?
      • From: Ricky Sharp <email@hidden>
References: 
 >IB Palettes? (From: Rick Mann <email@hidden>)
 >Re: IB Palettes? (From: Jonathan Hess <email@hidden>)

  • Prev by Date: Re: replacing NSViewAnimation with CoreAnimation
  • Next by Date: Auxiliary Data in custom view?
  • Previous by thread: Re: IB Palettes?
  • Next by thread: Re: IB Palettes?
  • Index(es):
    • Date
    • Thread