Nib File
Most plug-ins can have a nib file which is used for populating the inspector.
The nib file should contain, at its top level, at least the following:
- An NSView ("CustomView") representing the inspector's contents.
- An NSObjectController, which you bind the user interface elements to. It should not be bound to anything; this is handled by Sandvox when the plug-in loads. It is bound to the Sandvox plug-in object, not its delegate.
- File's Owner can be the class of the plug-in type (KTPage, KTPagelet, etc.) but it is probably more useful if it is set to be your delegate class, to allow for outlets and actions. Should it actually be the delegate? When creating your nib file, first drag in the KTAbstractPluginDelegate.h file in the Sandvox application bundle's "Frameworks" directory, then drag in your delegate's .h file.
- You can have other NSObjectControllers in your nib (say, an array controller) but these should be bound to something so that Sandvox can determine which is the "main" object controller.
Internationalization
Please use language codes (like "en") not names (like "English") for your localized resources. This means that the English nib would go into the en.lproj directory.
See also view layout guidelines below that will help with localization.
Bindings
In your bindings, there are several ways that you can bind (because the plug-in class forwards property requests to the delegate, and those are equivalent to the plugin properties, but the trick is to do the binding in such a way that you can do dependent keys and so forth.
The current suggestion is to bind to delegate.property. You may need to make explicit accessor methods in your plug-in delegate class.
View Layout
Your inspector view should be 250 pixels wide, and no more than about 300 pixels tall, please. In translated versions, the nib may be localized and resized to a wider width like 280 or 300 pixels. To help with this, here are some layout suggestions:
- Don't make things too crowded; this will help for languages with longer strings.
- Set the width of elements to go all the way across to the right margin, even if you don't need the space
- Set horizontal springs so that items are 'stretchy'.
Some other layout guidelines:
- Save your nib as 10.2 and later format, text format preferred.
- The view is not stretched horizontally so don't worry about vertical rods/springs.
- Border margins of the view should be 10 pixels on all sides, except the top which should be 8 pixels.