What’s New
Cocoa Touch Support
General Support
Interface Builder now supports creating interfaces for Cocoa Touch applications.
Selection menu for selecting any object under the mouse in the design canvas
Support for (re)focusing the connections window on the endpoint of a particular connection.
Localizable string management, including find and replace of values across multiple documents
Support for drag-based reordering in the outline view
Support for adding, deleting, reordering, and inserting into split views, tab views, and table views
Auto-selection of matching actions and scroll wheel support in the connection window
Auto-configuration of views (geometry, control size, and so on) when dragged from the library to the design surface
Addition of OTHER_IBTOOL_FLAGS
build setting, for specifying additional build-time arguments in Xcode
Changes to the layout of the XIB file format to make diffing easier
Menu for navigating to the Human Interface Guidelines
First Responder now shows all defined actions.
This property instructs the view controller’s view to grow to fill the screen’s application frame, when the NIB is loaded.
You can re-order or modify the subcontrollers in a UITabBarController by using the UITabBarController’s attributes inspector.
You can change the style of a table view by using the style popup of the UITableView inspector. The item in the popup label ‘indexed’ corresponds to the UITableViewStylePlain style.
Interface Builder now supports designing view controller hierarchies. Tab bar controllers and navigation controllers both support embedding child view controllers. Tab bar controllers support a variable array of of child view controllers, each with their own tab bar item. You can visually edit a view controller, tab bar controller, or navigation controller by double clicking on it from the document window. To add additional view controllers to a tab bar controller, drag a view controller from the library to your tab bar controller's editing window. Navigation controllers support one child view controller, the root item in the navigation hierarchy. Additional view controllers can be pushed to and popped from the navigation controller at runtime.
Many application will be composed entirely of a hierarchies of view controllers. Interface Builder will allow you to embed many view controllers in one document, however, you need to take care not to build your entire Interface in one document. Doing so would imply loading an application's entire user interface at once. This will result in poor performance and slow launch times. Instead, take advantage of the 'NIB Name' property of UIViewController
. In the UIViewController
attribute inspector, there is a 'NIB Name' property. If you set this property, then when the UIViewController
is instantiated from the edited document at runtime, it won't immediately have a controlled view. Instead it will load the view on demand from the NIB file named in the attribute inspector. To facilitate this on-demand loading, create a second Interface Builder document and mark the File's Owner
to have the same class as your view controller. Next, create a view in your second document and attach File's Owner's
'view' outlet to the view. When your original view controller is loaded at runtime, and it becomes time to fault in that view controller's view, it will load this secondary NIB. Using the 'NIB Name' property of view controllers in Interface Builder is most effective with the child controllers of tab bar controllers.
Open the object’s Identity inspector, and click the “+” button in the Class Actions section
Cocoa Touch Class Action inspector now supports two forms of action selectors
The single argument style: -(IBAction)someAction:(id)sender
To use this style, type the following into the inspector: “someAction:
” and press return.
The two argument style: - (IBAction)someAction:(id)sender withEvent:(UIEvent *)event
To use this style, type the following in the inspector: “someAction:withEvent:
” and press return.
The Objective-C parser used with Cocoa Touch documents will parse both single and double argument actions.
Add a new key to your Info.plist
called NSMainNibName
.
The value of this key should be a string containing the name of the NIB file you would like to use -- such as the "MainWindow".
The naming convention of this NIB is typically along the lines of YOURAPPNAME_MainWindow.nib
.
The .nib
extension is not required in the Info.plist
.
Drag a view controller object from the library into the document window.
In the document window, double-click the icon for the view controller object to open its editor.
Drag & and drop views, navigation items, and tab bar items from the Library onto the editor.
Windows have a new button in the upper right corner.
By default, windows use the portrait aspect ratio. Clicking the corner button rotates the window 90º into landscape mode.
Clicking the rotate button again reverses the rotation.
Note that View Controller also support rotation within IB.
Proxy Objects represent objects that exist outside of your NIB file.
You can make connections to and from Proxy Objects in Interface Builder and have them resolve to objects specified at run-time.
To use a proxy object, drag a Proxy Object from the Interface Builder Library to your document window.
Configure the class of the Proxy Object using the Identity Inspector.
Set the Name property of the Proxy Object. This value should be unique on a per-NIB basis.
To facilitate the replacement at runtime, do the following in your NIB-loading code:
Create a dictionary add add the actual object to the dictionary, using the value you put in the Name property of the Proxy Object as the key. (If your NIB file includes more than one Proxy Object, include all of the objects and Name keys in the same dictionary.)
Create another dictionary and associate your proxy-object dictionary with the UINibProxiedObjectsKey
key.
Pass this second dictionary into the options parameter of the loadNibNamed:owner:options:
method of NSBundle
.
Top level NIB objects are auto-released. (In Mac OS X, top levels objects are retained by default, and hence must be released explicitly on that platform.)
Outlets are set using the setValue:forKey:
method. This method retains outlets automatically, so if you use it, you must release those outlets in the object’s dealloc
method.
The awakeFromNib
message is sent to each object that was created as a side effect of loading the nib. This means that on the iPhone OS File’s Owner
and other proxy objects
do not receive this message. Please refer to the CocoaTouch
or Cocoa
documentation for a complete list of methods available for configuring your UI objects after NIB loading has occurred.
Not all of the fonts available in Mac OS X are available in iPhone OS.
Refocusing the connections window is a speedy way to view what objects the endpoint of a particular connection are connected to. For example, if you are viewing the connections for a menu item, you see that it is connected to the First Responder via an action. Let's say you want to see what other actions are also connected to the First Responder. Simply select (by single-clicking) the First Responder endpoint next to the connection of your menu item's action, and then click the refocus button that appears to the left of the connection button or double click the endpoint's label.
Having the ability to refocus the connections window eliminates the need to move to the endpoint of an object in the design canvas or document window in order to view what connections exist on that endpoint.
Refocusing works much in the way a browser behaves when navigating web pages. As you continue to recursively refocus, you can move back and forward through the history of your refocuses using the navigation buttons in the upper left corner of the connections window.
The connections window now has a concept of selection like other windows in Interface Builder. When you select a connection's endpoint, the lineage of that endpoint (i.e. Window -> Content View -> MyView) is displayed in a path control at the bottom of the window. Secondly, the inspector tracks the selection you just made. This makes it easy to make changes to objects that are visible in the connections window without having to select them in the document window or open them in the design canvas. And finally, selecting a connection's endpoint reveals the refocus button, allowing you to refocus the connections window on that endpoint.
The selection menu allows you to select any object you see on-screen, regardless of whether or not objects overlap or are hidden.
To bring up the selection menu, you can either shift right-click (shift-control left-click) over the object(s) you wish to select from.
Once the selection menu appears, it will contain all of the objects that were under the mouse at the time you brought up the menu.
Once you find the object you wish to select, click it.
While the maximum size constraint of windows with a zero max size and the "Has Maximum Size" checkbox enabled was previously ignored, Interface Builder 3.1 now enforces this constraint for any values considered valid by the NSWindow API.
Bring up the Strings window using the Tools -> Strings menu item (Control-S).
Select the appropriate document scope using the popup in the upper left (all documents or a selected document).
Enter a string in the search bar to filter the available strings, if necessary.
Enter the "Find" mode by selecting the Edit -> Find menu item (Command-F).
Change the popup from "Find" to "Find and Replace".
Enter the string to find, and its replacement string, in the available fields.
Use the arrow keys to locate each match. Use the "Replace" buttons to the right to replace the values.
The strings in the table can be edited in place simply by double-clicking on the value.
Double-clicking on items in other columns takes you to the associated object on the design surface.
Dragging or copying rows from the table view in the strings window produces text in the form of a strings file entry.
In the connections window, you cannot select connection endpoints that are fixed, such as the menu of an NSPopUpButton or a formatter of an NSTextField or NSTextFieldCell.
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-05-30)
|