Graphics Programs Reference
In-Depth Information
#import "HypnosisViewController.h"
#import "HypnosisView.h"
@implementation HypnosisViewController
- (void)loadView
{
// Create a view
CGRect frame = [[UIScreen mainScreen] bounds];
HypnosisView *v = [[HypnosisView alloc] initWithFrame:frame];
// Set it as *the* view of this view controller
[self setView:v];
}
@end
In
HypnoAppDelegate.m
, create an instance of
HypnosisViewController
and
set it as the
rootViewController
of the
UIWindow
. Make sure to import
Hyp-
nosisViewController.h
at the top of this file.
#import "HypnoAppDelegate.h"
#import "HypnosisViewController.h"
@implementation HypnoAppDelegate
@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.
HypnosisViewController *hvc = [[HypnosisViewController alloc] init];
[[self window] setRootViewController:hvc];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
Build and run the application. You will see an instance of
HypnosisView
grace the
screen; this is
HypnosisViewController
's
view
.
Figure 7.4 Application diagram