• 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: replacing self in initWithCoder method? {advanced}
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: replacing self in initWithCoder method? {advanced}


  • Subject: Re: replacing self in initWithCoder method? {advanced}
  • From: Jérôme Laurens <email@hidden>
  • Date: Thu, 28 Nov 2002 09:27:56 +0100

Le mercredi, 27 nov 2002, ` 21:54 Europe/Zurich, Dan Wood a icrit :

I have some UI elements in a nib that are subclasses of NSComboBox -- however, I would like to, via a preference, just show them as a plain NSTextField instead. (NSTextField happens to be a subclass of NSComboBox.)

I'm thinking that maybe I can fake this in the initWithCoder: method of MyComboBox, so that if the preference is set to use a plain NSTextField instead, I replace self with an NSTextField.

However, it's not working (I end up seeing a combo box in the interface, though it doesn't respond to the popup button. And, I get this message at runtime when the NSTextField is built:

NSView not correctly initialized. Did you forget to call super?

Am I doing this wrong? Any suggestions on making this work?

Dan



As far as I understand, the format of the data in the coder is severely tied to the class that created the archive. So,
you should always call -[NSComboBox initWithCoder:]. Once the combo box is inited, you can decide to use it as is or just make a NSTextField poor man clone.

BTW, this is weird design: NSComboBox is a subclass of NSTextField, not the converse
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >replacing self in initWithCoder method? {advanced} (From: Dan Wood <email@hidden>)

  • Prev by Date: Re: Custom window not getting delegate notifications
  • Next by Date: Re: NSTextView text changes size
  • Previous by thread: replacing self in initWithCoder method? {advanced}
  • Next by thread: [NSMutableAttributedString size]
  • Index(es):
    • Date
    • Thread