Use Interface Builder to configure the
SettingsViewController.xib file and create the user interface.
Although the provided XIB file is already configured, you can walk through the steps to see
how to create the interface.
- Click the SettingsViewController.xib file to reveal a view of
the (presently empty) screen in the right pane and the following three items
represented by icons in the middle pane:
- File's Owner – the object that is set to be the owner of the user interface,
which is typically the object that loads the interface. In this tutorial, this
is the SettingsViewController.
- First Responder – the first responder proxy object handles events. Connecting
an action to the first responder means that when the action is invoked, it is
dynamically sent to the responder chain.
- View – appears in a separate window to allow editing.
- Select the File's Owner icon, click
View in the utility area, click Show the
Identity Inspector, and make sure
SettingsViewController appears in the Class field under
Custom Class.
This tells Interface Builder the class of the object to allow you to make
connections to and from the File's Owner.
- Click the View icon, and in the Identity Inspector panel,
and make sure UIView appears in the Class field under Custom
Class.
- To add a Table view, select .
- In the Object Library pane, select the Table View item, and
drag it onto the view.
- To make connections to the user interface from the view controller, the
SettingsViewController.h file contains the outlets.
@ interface SettingsViewController : UIViewController
{
IBOutlet UITableView *m_settingsTableview;
}
- Go to SettingsViewController.xib, select and right-click the
File Owner. In Outlets,
m_settingsTableview appears.
- Drag from the m_settingsTableview circle to view and
release. The connection to the File Owner has been made. A
pop-up with datasource and delegate appears in the table view.
- Select the Table View, go to
IBInterfaceBuilder, select Style to
Grouped.
- Set the background color of the view to Clear Color.
- In Referencing Outlets -> New Referencing Outlet, drag from
the right circle to table view and release. A pop-up with datasource and delegate
appears in the view. Select datasource to establish a
connection between table view and table view datasource methods.
- In Referencing Outlets -> New Referencing Outlet, drag from
the right circle to table view and release. A pop-up with datasource and delegate
appears in the view. Select delegate to establish a connection
between table view and table view callback methods.