Graphics Programs Reference
In-Depth Information
This will ensure that all instances of ItemsViewController use the UIT-
ableViewStyleGrouped style, no matter what initialization message is sent to it.
Open HomepwnerAppDelegate.m . In applica-
tion:didFinishLaunchingWithOptions: , create an instance of Item-
sViewController and set it as the rootViewController of the window. Make
sure to import the header file for ItemsViewController at the top of this file.
#import "ItemsViewController.h"
@implementation HomepwnerAppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
// Create a ItemsViewController
ItemsViewController *itemsViewController = [[ItemsViewController alloc] init];
// Place ItemsViewController's table view in the window hierarchy
[[self window] setRootViewController:itemsViewController];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
Build and run your application. You will see the default appearance of a plain UIT-
ableView with no content, as shown in Figure 9.5 . How did you get a table view? As a
subclass of UIViewController , a UITableViewController inherits the view
method. This method calls loadView , which creates and loads an empty view object if
none exists. A UITableViewController 's view is always an instance of UIT-
ableView , so sending view to the UITableViewController gets you a bright,
shiny, and empty table view.
Figure 9.5 Empty UITableView
 
Search WWH ::




Custom Search