Graphics Programs Reference
In-Depth Information
In
TouchViewController.m
, override
loadView
to set up an instance of
TouchDrawView
as
TouchViewController
's
view
. Make sure to import the
header file for
TouchDrawView
at the top of this file.
#import "TouchViewController.h"
#import "TouchDrawView.h"
@implementation TouchViewController
- (void)loadView
{
[self setView:[[TouchDrawView alloc] initWithFrame:CGRectZero]];
}
@end
In
AppDelegate.m
, create an instance of
TouchViewController
and set it as the
rootViewController
of the window. Don't forget to import the header file for
TouchViewController
in this file.
#import "AppDelegate.h"
#import "TouchViewController.h"
@implementation AppDelegate
@synthesize window = _window;
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
TouchViewController *tvc = [[TouchViewController alloc] init];
[[self window] setRootViewController:tvc];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}