Graphics Programs Reference
In-Depth Information
When an application has a main storyboard file, it will automatically load that storyboard
when the application launches. In addition to loading the storyboard and its view control-
lers, it will also create a window and set the initial view controller of the storyboard as the
root view controller of the window. You can tell which view controller is the initial view
controller by looking at the canvas in the storyboard file - the initial view controller has
an arrow that fades in as it points to it.
Since a storyboard file supplies the window for an application, the application delegate
doesn't need to create a window. In BNRAppDelegate.m , remove the code from ap-
plication:didFinishLaunchingWithOptions: that creates the window.
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
Build and run the application, and you'll see a view of a view controller and a navigation
bar that says Root View Controller ( Figure 24.6 ) . All of this came from the storyboard file
- you didn't even have to write any code.
Figure 24.6 Initial Storytime screen
 
 
Search WWH ::




Custom Search