Re: Creating a NSView with Interface Builder
Re: Creating a NSView with Interface Builder
- Subject: Re: Creating a NSView with Interface Builder
- From: perego <email@hidden>
- Date: Tue, 26 Feb 2008 09:12:55 +0100
Hello,
i'm currently working on a Plugin. My problem is that i have to
provide a preference View. I have to give a NSView to the programm.
Currently i wrote a NSView Subclass, but its to much work to do every
button an textfield by code. My question is, how can I design an View
in Interface Builder an give the result as an NSView to an other
object.
I hope you understand my problem
thanks
thomas
I've done that many times and it is not too complicated. In my case, a
contol palette of the main app
has different tab views. One of these must show content provided by
the plugin that is presently enabled
(I implement a fit procedure where the main app provides the
calculating engine and different
plugins specify the functions to be used). With my approach you create
within your plug-in a NIB file containing a custom view (there is even
a template for this purpose in IB vers. 3)
and a controller class (I'd say, subclassing NSWindowController) for
that view.
This class should be the owner of the NIB file and contain all
outlets / actions pertaining to it.
Its init routine should have the superview of the view you want to
show (in my case, the empty tab view
of the palette) as a parameter (some event in
the main program triggers the principal class of your plug-in, which,
in turn, starts your controller).
The controller class loads the NIB file and inserts the view in its
superview. Then, it manages every
user interaction through the controls located within the view.
I hope I've given you an idea. If not, I might send you some snippet.
Andrea
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden