Re: Using an IB-built view multiple times
Re: Using an IB-built view multiple times
- Subject: Re: Using an IB-built view multiple times
- From: Christopher Drum <email@hidden>
- Date: Tue, 20 Sep 2005 16:41:07 -0700
No, I'm sorry if my original explanation was confusing. I mean, I
want to build a view in IB, then use that view repeatedly to populate
some master view programatically. I have found an example of this in
some sample Apple code in the CoreRecipes application. There is an
option for adding and subtracting search predicates, each of which is
an instance of an IB-built view. These instances are then added as
subviews to a primary view. I had not seen that code prior to my
question.
I'm still struggling with it a little. As I understand the
CoreRecipes code, ClassA can contain a non-instantiated member
variable pointing to an NSView. ClassB can instantiate a view from an
NSNib citing an object of ClassA as the owner. Somehow, through a
magical mechanism I fail to see, ClassA's NSView and ClassB's
instantiation then link up properly during initWithNibNamed:bundle:,
after which the NSView can be accessed via ClassA's member variable
for that view.
I'm working on some sample code to verify this process, but thanks
everyone for pointing me toward the NSNib. All that research into
NSBundle and I just never came across NSNib. The initial struggle was
understanding how to suck the NSView out of the NSNib for adding as a
subview to my primary view. That process still seems a little cryptic
to me, but I think I'm making progress.
Any insight into understanding this process would be appreciated.
Apple's docs seem to stop a little short of explaining how the member
variables of the owner and the objects of the NIB sort themselves
out. What if I had three pulldown menus in my secondary NIB that
needed to be instantiated and linked up to the owner object? How
would I tell the owner object which NIB menu links up to which member
variable of the owner? Is that where
instantiateNibWithExternalNameTable: comes into play? I'm finding the
Apple docs a little confusing about the order of events and I don't
really see many samples of putting these methods to use.
Christopher Drum
On Sep 20, 2005, at 4:03 PM, Ricky Sharp wrote:
When you say "build the template graphically", do you mean dragging
out instances of them in IB?
_______________________________________________
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