General
Summary of New Features
Known Issues and Workarounds
Additional Documentation
Supported configurations
Interface Builder 3.0 runs on Mac OS X 10.5 (Leopard).
IB2 Palettes do not work with IB3
Based in part on developer feedback and adoption, Interface Builder 3 provides a new, much simpler and more flexible plug-in model for integrating custom views and controls into the application. Please see the section on Additional Documentation and Help.
Loading Plug-ins
To load an Interface Builder 3.0 plug-in, click on the Plus button in the Plug-ins section of the preference pane. Plug-ins are now built into their frameworks, so you need to navigate to the framework that contains the plug-in. Alternatively, you can also drag-and-drop a plug-in into the Plug-ins preference pane.
xibtool has been replaced with ibtool
Please see the ibtool man page for more documentation. The following is information not included in the man page.
ibtool Property Plists
There are two new options in ibtool that enable you to export the properties of a nib to a plist, change their values and import the new values back into the plist.
Exporting: --export
For each object in the nib, export the properties specified in a specified XML property list to an output property list. The property list should contain a dictionary of class name arrays containing strings of key paths for properties. The output is a dictionary in XML property list format where each key is an object ID, and each value is a dictionary of key paths and their associated value. If a key in the second level dictionary begins with a .
, it isn't a key path. Currently, the only special key is .nilKeypaths
. It identifies an array of key paths whose value was nil
. For example,
ibtool --export Simple.plist Simple.nib > output.plist |
exports the properties of Simple.nib
specified by Simple.plist
into a file named output.plist
.
Importing: --import
For each object in the nib identified by the contents of an imported property list, take the properties specified in the property list and apply them to the object. The imported property list is in the same format as the output of the --export
command. Be aware that setting a property may have the side effect of not actually changing the property or possibly altering additional properties. Typically this option is combined with --write
. For example,
ibtool --import Simple.plist --write NewSimple.nib Simple.nib |
applies the Simple.plist
changes to the Simple.nib
file and creates a new nib named NewSimple.nib
.
Example
The following example is run on a nib with an NSButton, NSTextField, and an NSTextView inside of an NSWindow. This example demonstrates how to extract strings as well as geometry from the nib. One thing to note, the className
property on NSObject is only used here to make reading the resulting plist easier. The className
property is an example of a property that can not be changed, so the resulting plist can not be fed back into ibtool without removing all references to className
first.
This example demonstrates how to extract the geometry of the whole frame, the frame origin, the frame width, and the frame height. These could just as easily be replaced or supplemented with other requests such as
<string>frame.origin.x</string> |
<string>frame.origin.y</string> |
<string>frame.size</string> |
<string>subviews.frame</string> |
<string>subviews.subviews.frame</string> |
They could also be moved up the hierarchy to NSView if you need the properties for all subclasses of NSView.
The following plist is used for extracting information from the nib.
<?xml version="1.0" encoding="UTF-8"?> |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
<plist version="1.0"> |
<dict> |
<key>NSButton</key> |
<array> |
<string>keyEquivalent</string> |
<string>keyEquivalentModifierMask</string> |
<string>title</string> |
</array>p |
<key>NSObject</key> |
<array> |
<string>className</string> |
</array> |
<key>NSTextField</key> |
<array> |
<string>editable</string> |
</array> |
<key>NSTextView</key> |
<array> |
<string>frame</string> |
<string>frame.origin</string> |
<string>frame.size.width</string> |
<string>frame.size.height</string> |
</array> |
<key>NSView</key> |
<array> |
<string>hidden</string> |
</array> |
</dict> |
</plist> |
The following is the resulting plist.
<?xml version="1.0" encoding="UTF-8"?> |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
<plist version="1.0"> |
<dict> |
<key>-1</key> |
<dict> |
<key>className</key> |
<string>FirstResponder</string> |
</dict> |
<key>2</key> |
<dict> |
<key>className</key> |
<string>NSView</string> |
<key>hidden</key> |
<integer>0</integer> |
</dict> |
<key>21</key> |
<dict> |
<key>className</key> |
<string>NSWindow</string> |
</dict> |
<key>249</key> |
<dict> |
<key>className</key> |
<string>NSTextField</string> |
<key>editable</key> |
<integer>1</integer> |
<key>hidden</key> |
<integer>0</integer> |
</dict> |
<key>339</key> |
<dict> |
<key>className</key> |
<string>NSButton</string> |
<key>hidden</key> |
<integer>0</integer> |
<key>keyEquivalent</key> |
<string>m</string> |
<key>keyEquivalentModifierMask</key> |
<integer>1048576</integer> |
<key>title</key> |
<string>Withdraw</string> |
</dict> |
<key>340</key> |
<dict> |
<key>className</key> |
<string>NSScrollView</string> |
<key>hidden</key> |
<integer>0</integer> |
</dict> |
<key>341</key> |
<dict> |
<key>className</key> |
<string>NSTextView</string> |
<key>frame</key> |
<string>{{0, 0}, {149, 56}}</string> |
<key>frame.origin</key> |
<string>{0, 0}</string> |
<key>frame.size.height</key> |
<real>56</real> |
<key>frame.size.width</key> |
<real>149</real> |
<key>hidden</key> |
<integer>0</integer> |
</dict> |
</dict> |
</plist> |
Known Issues with plist import and export
The properties of NSWindow are not accessible with the plist export and import at this time.
There may be unavoidable side effects of changing property values. Changing one property may also change a related property in that control.
Some controls may not allow certain properties to be changed.
Importing property values from a plist does not cause the controls to size to fit. For example, changing the title of a button does not change the size of the button to fit the new text.
XIB files are not human editable
XIB files are the result of writing an in-memory object graph to disk, by using a custom serialization protocol. Editing XIB files by hand is not suggested, extremely dangerous, and can lead to corrupted interfaces
XIB 3.x and NIB 3.x files are not backward compatible for development
There are some features that can only be developed using the XIB 3.x or NIB 3.x formats. Support for these features—such as support for toolbars, and the promotion of cells to first-class citizens—either required underlying changes in AppKit to support, or introduced new content into the document hierarchy that previous versions of Interface Builder can not handle. Interface Builder 3.0 includes an automatic compatibility check, performed before saving, which will inform you of items which affect the file format compatibility.
Adding a Core Data Entity to IB3
To create an interface to your Core Data model, drag the Entity object from the Library to your Document Window. This brings up a wizard that steps you through the configuration process.
How to make connections
You can still make connections by control-dragging between objects, but we highly recommend you try control-clicking. Control-clicking an object brings up a context-sensitive display allowing you to make action, outlet, or accessibility connections.
Layout validation is now automated
The Layout Validation menu item has been removed because it happens automatically now. Use the Information Window available from the Document Window to see all warnings and errors for your document. You can change the categorization of warnings, errors, and notes in the preference pane.
Moving an object without breaking connections
When you copy a group of objects, only connections internal to that group go onto the pasteboard. Because of this, copying and pasting objects typically breaks connections. To move a view, rather than copy and paste it, you need to Pop-and-Drag. Select a group of views, click, and hold without moving the mouse. The views will lift off the window and you can move them. As long as you keep them in the same document, their connections won't break.
Grouping
The Group menu item has been removed. To group objects together, you can contain them in a custom view. You can also store a custom view as a top-level item in your document window, or you can pop-and-drag it back to the library to store it for reuse.
Adding classes, actions, and outlets.
The preferred workflow is to create your classes in Xcode. You can then use the Identity Inspector to set the custom class of an object and the header file will be automatically synced when your code changes. However, if you prefer, you can specify a new class in the Identity Inspector and use the Write Class Files... menu in the File menu to generate files for you. In the Identity Inspector, you can add custom actions and outlets then copy/paste, drag and drop, or use the menu to create the definitions in your header file.
Image resources can not be stored in a NIB.
The practice of storing image resources such as TIFF files in NIBs has been discouraged for a number of releases. Interface Builder 3 no longer recognizes resources that are stored in a NIB.
General
There is a new connection context menu. Control-click to see a list of actions, outlets, and accessibility connections that can be made. Drag from the circle to the item to make the connection to. As you mouse over the interface, only items that can complete a connection are highlighted.
Decompose Interface—available in the File menu—breaks your interface into smaller nibs. Smaller nibs ensure faster loading of your application by only loading interface items that are needed.
You can use the tab key to access each of the widgets in your view sequentially.
There are new menu items for selecting the parent, child, and siblings of the selected control. This aids in accessing those hard to reach controls like Scrollers.
Holding the shift key while resizing a view allows you to restrain the resizing to horizontal, vertical, or proportional.
The option key can be toggled while resizing to show layout information.
Use the Enable Autoresizing menu item in the Layout menu to allow views to resize with their top-level containing view according to their springs and struts. Holding the command key while resizing a top level view inverts the sense of the menu item and can be toggled.
File Formats
There are three development-time file formats:
XIB 3.x file
A XIB file is a flat version of a nib file, encoded in a human readable XML format. When used with the Xcode v3.x toolchain, they are compiled during the build phase into a flat NIB file—a NIB with just the keyedobjects.nib data. The resulting file is deployable on any recent Mac OS X version, but cannot be opened for development as it is just a deployment file.
NIB 3.x wrapper
These are wrappers ending in .nib that contain two files: designable.nib and keyedobjects.nib. These files can only be opened with Interface Builder 3. However, the keyedobjects.nib file in the wrapper is the same format as the NIB 2.x wrapper, and thus these are deployable on any recent Mac OS X version.
NIB 2.x wrapper
These are wrappers, ending in .nib that contain three files: classes.nib, info.nib, and keyedobjects.nib. These files can be opened for development with any version of Interface Builder. Only the keyedobjects.nib file is required at runtime, and these files are deployable on any recent Mac OS X version.
Document Window
The document window has been updated with the following items:
Command double-clicking on anything in the Document Window jumps to the appropriate header file.
A new search field you can use to search for objects by name, id, or type.
A browser mode in addition to the existing icon and outline mode.
A rearrangeable icon view of top level objects. This allows for grouping of related items.
A status bar showing what Xcode project a nib file is related to, whether that project is currently available, and if there are any warnings or errors. Warnings and errors may be viewed by clicking on the information button at the top of the document window.
Library
The Palettes have been replaced by the concept of a Library to hold all of your controls and media. The Library adds a lot of functionality such as
A search field for quickly finding controls.
Smart groups to assemble common controls.
User-defined groups to organize your favorite controls, controls specific to a project, or your customized controls. Drag any configured control back to the Library to save it in one of your user-defined groups.
Icon; Icon and Label; and Icon and Description mode available in the pull-down menu in the lower left corner of the Library. You can choose what level of documentation you would like to see, including a detail view explaining how to use the control you’ve selected. Icon mode saves space. Icon and Label mode shows you the icon and the label to help aid you in searching. Icon and Description mode shows you the icon, label, and a short description explaining how to use the control.
Inspectors
There are a number of new features available in the Inspector window such as
Support for multiple selection. Select any set of controls and you can edit any of their common properties.
Documentation tooltips for properties in the Inspector.
A realtime animation showing how the selected control will behave based on the springs and struts set in the Size Inspector.
Copy/Paste Attributes is available in the Edit menu.
Per object notes that allow you to leave detailed information for other developers, or for yourself in the future. These notes show as tooltips when you hover over the control in Interface Builder.
Xcode Integration
There are a number of new ways that Interface Builder integrates with Xcode when the related Xcode project is open. For example,
Automatic synchronization of headers.
Loading of resources into the Library Media Browser.
Warnings and errors in Xcode when a XIB is built. You can set the priority of notices, warnings and errors in Interface Builder’s preference pane.
New templates in Xcode makes it easy to add new XIBs directly to your project.
Plug-ins
IBPalette has been replaced with a new Interface Builder Plug-in model. See the documentation links in the Additional Documentation and Help section of this document for instructions on creating a new Interface Builder Plug-in.
Cocoa Specific
Interface Builder 3 adds new support for the following Cocoa controls and functionality:
Core Animation
Toolbars
Tree Controller
Dictionary Controller
Path Control
10.4+ Formatters
Carbon Specific
Interface Builder 3 now provides HIView subclassing for all Carbon views.
Undo and Multiple Value Placeholder Binding
Undoing edits on the Multiple Value Placeholder value results in an entire binding being removed.
Smart Groups of Carbon Elements
The smart group rule “Is kind of” doesn’t respond to Carbon class names. Try the Cocoa counterpart if available.
Carbon Library
The Carbon library is missing a vertical slider element.
Carbon Tab Views
Carbon tab views appear distorted within Interface Builder.
Mini Carbon Controls
Mini-sized Carbon controls don’t have the correct height and may not be usable when simulated.
Carbon Nibs from Interface Builder 2
Various Carbon controls in Nibs created with previous versions of may have incorrect layout rectangles.
Carbon Controls with Text
Carbon Controls with text don’t have layout baselines for text alignment.
Removing Classes from Nibs
There is no method for removing a class from a Nib. If the class is removed from the Xcode project, it’s automatically removed from the Nib.
Renaming Methods Removes Connections
Renaming a method in a header file breaks its connections in Interface Builder. You need to update each connection to point to the new method name.
Categories and Classes in a Header Fle
Interface Builder displays only category information when both a class and a category are present in a header file.
Hidden Scroll Bars
Unhiding hidden scroll bars doesn’t show them.
Using ibtool’s --convert Flag
Using the --convert
flag with ibtool
fails when new class name already exists.
Localized Formatters
Localized formats may not be used when running in a localized language.
Selecting Elements with Core Animation Effects
Elements with “Wants Core Animation Layer” active cannot be directly selected.
The following documentation is available for Interface Builder 3:
You can access the documentation from the Xcode documentation viewer. In Xcode, choose Help > Documentation to open the viewer window. Using the search filters at the top of the window, you can search for these books by title or you can browse for them in the Developer Tools Reference Library.
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-03-05)
|