• 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
First-Time Help Needed: Instantiating a Subclass in IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

First-Time Help Needed: Instantiating a Subclass in IB


  • Subject: First-Time Help Needed: Instantiating a Subclass in IB
  • From: Jerry Krinock <email@hidden>
  • Date: Fri, 14 Oct 2005 19:34:15 -0700
  • Thread-topic: First-Time Help Needed: Instantiating a Subclass in IB

I want to instantiate a subclass of NSTextField.

In Interface Builder Help I read the following instructions for
instantiating a subclass:

> ... If you¹re subclassing ... NSTextField ...
> From the Views palette ...
> drag the object that represents that class.

Ok, so I find a white rectangle that looks like an NSTextField, with a
tooltip that says "NSTextField", drag and drop it into my window.

> Choose Tools > Show Info, choose Custom Class from the menu ...
> select your class from the list, and double-click ...

OK, I did that.  Now I see in my nib's main document window, Instances tab,
list view, that this field is a "MyTextField".  Looks cool.

My problem:  At run-time, my subclass' -initWithFrame method doesn't run for
this field.  The field still acts like a plain old NSTextField.

BUT.....if instead of using the above documented procedure, I drag and drop
a "Custom View" (the purple rectangle) out of the palette, and then edit its
class to MyTextField, then compile and run, this field *does* get
initialized by my subclass and *does* exhibit my subclass' behavior.  So the
problem appears to be in the way I instantiate it.

Why doesn't the documented method work for me?  (I have another reason,
besides furthering my education, for needing to do it that way).

Thanks,

Jerry Krinock


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: First-Time Help Needed: Instantiating a Subclass in IB
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Fwd: UInt8 * to NSString
  • Next by Date: Drag image of NSView
  • Previous by thread: Fwd: UInt8 * to NSString
  • Next by thread: Re: First-Time Help Needed: Instantiating a Subclass in IB
  • Index(es):
    • Date
    • Thread