iPhone/Classes/HelloWorldAppDelegate.m
changeset 37 7c7d5a0cb4d6
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/iPhone/Classes/HelloWorldAppDelegate.m	Tue May 05 15:10:15 2009 -0700
     1.3 @@ -0,0 +1,84 @@
     1.4 +/*
     1.5 +
     1.6 +File: HelloWorldAppDelegate.m
     1.7 +Abstract: Responsible for creating the view controller and adding its view to
     1.8 +the window.
     1.9 + 
    1.10 + See the ReadMe file for pointers to additional resources about iPhone
    1.11 +development.
    1.12 +
    1.13 +Version: 1.7
    1.14 +
    1.15 +Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
    1.16 +("Apple") in consideration of your agreement to the following terms, and your
    1.17 +use, installation, modification or redistribution of this Apple software
    1.18 +constitutes acceptance of these terms.  If you do not agree with these terms,
    1.19 +please do not use, install, modify or redistribute this Apple software.
    1.20 +
    1.21 +In consideration of your agreement to abide by the following terms, and subject
    1.22 +to these terms, Apple grants you a personal, non-exclusive license, under
    1.23 +Apple's copyrights in this original Apple software (the "Apple Software"), to
    1.24 +use, reproduce, modify and redistribute the Apple Software, with or without
    1.25 +modifications, in source and/or binary forms; provided that if you redistribute
    1.26 +the Apple Software in its entirety and without modifications, you must retain
    1.27 +this notice and the following text and disclaimers in all such redistributions
    1.28 +of the Apple Software.
    1.29 +Neither the name, trademarks, service marks or logos of Apple Inc. may be used
    1.30 +to endorse or promote products derived from the Apple Software without specific
    1.31 +prior written permission from Apple.  Except as expressly stated in this notice,
    1.32 +no other rights or licenses, express or implied, are granted by Apple herein,
    1.33 +including but not limited to any patent rights that may be infringed by your
    1.34 +derivative works or by other works in which the Apple Software may be
    1.35 +incorporated.
    1.36 +
    1.37 +The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
    1.38 +WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
    1.39 +WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    1.40 +PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
    1.41 +COMBINATION WITH YOUR PRODUCTS.
    1.42 +
    1.43 +IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
    1.44 +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
    1.45 +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.46 +ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
    1.47 +DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
    1.48 +CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
    1.49 +APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.50 +
    1.51 +Copyright (C) 2008 Apple Inc. All Rights Reserved.
    1.52 +
    1.53 +*/
    1.54 +
    1.55 +#import "HelloWorldAppDelegate.h"
    1.56 +#import "MyViewController.h"
    1.57 +
    1.58 +
    1.59 +@implementation HelloWorldAppDelegate
    1.60 +
    1.61 +@synthesize window;
    1.62 +@synthesize myViewController;
    1.63 +
    1.64 +
    1.65 +- (void)applicationDidFinishLaunching:(UIApplication *)application {
    1.66 +	
    1.67 +	// Set up the view controller
    1.68 +	MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"HelloWorld" bundle:[NSBundle mainBundle]];
    1.69 +	self.myViewController = aViewController;
    1.70 +	[aViewController release];
    1.71 +    
    1.72 +    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
    1.73 +	
    1.74 +	// Add the view controller's view as a subview of the window
    1.75 +	UIView *controllersView = [myViewController view];
    1.76 +	[window addSubview:controllersView];
    1.77 +	[window makeKeyAndVisible];
    1.78 +}
    1.79 +
    1.80 +
    1.81 +- (void)dealloc {
    1.82 +	[myViewController release];
    1.83 +	[window release];
    1.84 +	[super dealloc];
    1.85 +}
    1.86 +
    1.87 +@end