Re: Copying an NSView?
Re: Copying an NSView?
- Subject: Re: Copying an NSView?
- From: Ondra Cada <email@hidden>
- Date: Sat, 26 Jan 2002 22:19:38 +0100
Tom,
>
>>>>> Tom Dale (TD) wrote at Sat, 26 Jan 2002 11:56:16 -0800:
TD> I used [NSBundle loadNibNamed:@"nibName" owner:self ]; but after that
TD> I'm not sure how to access the classes in it.
I hope you did not mean it, but to be sure, let's explain:
there are *no classes* in NIB. All classes are in the application/library
code (and loadable bundles perhaps, and it is possible to build new classes
runtime, but just forget this: you won't ever need the information ;)))
NIB contains just instances.
TD> I am now
TD> very confused as to how I can access the elements that are created when
TD> loading a nib file.
Just like with any other NIB -- through outlets of File's Owner.
(i) in the @interface of the class whose instance loads the NIB add an
appropriate outlet, like
...
IBOutlet NSView *myLoadableView;
...
(ii) drop this header over the NIB main window...
(iii) ... and in the Inspector select the class to be the one of File's Owner.
(iv) Now you can connect (normal Ctrl-drag) the outlet of File's Owner to
the view. 'Course there can be any number of outlets connected the same way.
Now, immediately after you call (successfully) [NSBundle
loadNibNamed:@"nibName" owner:self], the outlet will contain the id of the
newly made view.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc