Running the View-Based Application Template
When you start a project with the View-based Application template, you get the Main window, a view (using a white background) scaled to fill the entire Main window, and a black status bar at the top. The view and status bar automatically change orientation for you when the user rotates the iPad.
You can see this in action in the Simulator, even before writing any code - after choosing the template to create your project, build and run the project by choosing Build → Build and Run from the Xcode main menu.
After a user launches your app, the functionality provided in the UIKit framework manages most of the application's infrastructure. Part of the initialization process setting up the main run loop and event-handling code, which is the responsibility of the UIApplication object. When the application is onscreen, it's driven by external events, such as stubby fingers touching sleek buttons.
The nib file MainWindow.xib causes the application's delegate, window, and view controller instances to get created at runtime, and both MainWindow.xib and the view controller's nib file, DeepThoughtsViewController.xib, are provided as part of the Viewbased Application template. An instance of DeepThoughtsViewController is set to be the application's view controller, and that's where you put your code to control the view.
Before doing that, however, you can build this view to have a background image and some interface elements. To see what you have in the view now, you can inspect the view in Interface Builder.
Inspecting the View
To see how the view is created and connected to the template code, start up Interface Builder from Xcode by first clicking the Resources folder in the Groups → Files list and then double-clicking the DeepThoughtsViewController.xib file to launch Interface Builder.
To inspect the view, click the Identity tab of the Inspector window (or choose Tools → Identity Inspector) and then click the View icon in the DeepThoughtsViewController.xib window to see the identity of the view.
Tip: The four icons across the top of the Inspector window from left to right correspond to the Attributes, Connections, Size, and Identity Inspectors, respectively, in the Tools menu.
You can see that the view belongs to the UIView class, and that user interaction has been enabled. UIView is an abstract superclass that provides concrete subclasses with a structure for drawing and handling events. The UIView class provides common methods you can use to create all types of views as well as access their properties.
You can also click the Attributes tab of the Inspector window (or choose Tools → ttributes Inspector) to see the view's attributes - and you find that it includes a black status bar and the default (white) background.
To get info about the class that uses, or owns, this view, click File's Owner in the DeepThoughtsViewController.xib window and then click the Identity tab of the Inspector window (or choose Tools → Identity Inspector). In the Class popup menu, you can see that the File's Owner - the object that's going to use (or own) this file - is set to the class DeepThoughtsViewController. Click the circled arrow next to DeepThoughtsViewController in the Class pop-up menu to display the class in the Library window along with its description.