Re: nibs, subclassing nsview
Re: nibs, subclassing nsview
- Subject: Re: nibs, subclassing nsview
- From: Wagner Truppel <email@hidden>
- Date: Thu, 24 Aug 2006 01:19:14 -0700
Jim,
I think the essential clue that may not have been made clear in other
people's replies is this: when creating a custom view (ie, an NSView
subclass corresponding to your custom view), you are *not* supposed
to actually *instantiate* it in Interface Builder. Rather, you should
(a) only make IB *aware* of it, by dragging its interface file onto
the main IB window for your nib file,
(b) drag a custom view item from IB's palette to the window or panel
of your nib, where the custom view is supposed to sit (and then
configure its size and other such properties), and
(c) set its class to match the intended subclass of NSView, using the
appropriate IB's Inspector window.
Then, it's up to you to *programatically* create an actual instance
of that custom view, using the code that others have already suggested.
Note that this is different from what you do with other kinds of
objects, for which you actually create an instance from within IB
itself. So, what happened in your case is that you created an actual
instance of your custom view, from within IB, added buttons and such
to it, but that custom view object was never "seen" by your code,
because your code didn't create it. What your code did create and
drew on was *another* instance of your custom view, but not the one
which you added the buttons and such to.
Wagner
============
The difference between an auto mechanic and a quantum mechanic is
that the quantum mechanic can get the car inside the garage without
opening the door.
_______________________________________________
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