iPhone/Classes/HelloWorldAppDelegate.m
author Dan Preston <danpreston@codechemistry.com>
Tue May 05 15:12:18 2009 -0700 (2009-05-05)
changeset 39 5ed02247b7fc
permissions -rwxr-xr-x
Enabled garbage collection as being supported in the library target.
snej@25
     1
/*
snej@25
     2
snej@25
     3
File: HelloWorldAppDelegate.m
snej@25
     4
Abstract: Responsible for creating the view controller and adding its view to
snej@25
     5
the window.
snej@25
     6
 
snej@25
     7
 See the ReadMe file for pointers to additional resources about iPhone
snej@25
     8
development.
snej@25
     9
snej@25
    10
Version: 1.7
snej@25
    11
snej@25
    12
Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
snej@25
    13
("Apple") in consideration of your agreement to the following terms, and your
snej@25
    14
use, installation, modification or redistribution of this Apple software
snej@25
    15
constitutes acceptance of these terms.  If you do not agree with these terms,
snej@25
    16
please do not use, install, modify or redistribute this Apple software.
snej@25
    17
snej@25
    18
In consideration of your agreement to abide by the following terms, and subject
snej@25
    19
to these terms, Apple grants you a personal, non-exclusive license, under
snej@25
    20
Apple's copyrights in this original Apple software (the "Apple Software"), to
snej@25
    21
use, reproduce, modify and redistribute the Apple Software, with or without
snej@25
    22
modifications, in source and/or binary forms; provided that if you redistribute
snej@25
    23
the Apple Software in its entirety and without modifications, you must retain
snej@25
    24
this notice and the following text and disclaimers in all such redistributions
snej@25
    25
of the Apple Software.
snej@25
    26
Neither the name, trademarks, service marks or logos of Apple Inc. may be used
snej@25
    27
to endorse or promote products derived from the Apple Software without specific
snej@25
    28
prior written permission from Apple.  Except as expressly stated in this notice,
snej@25
    29
no other rights or licenses, express or implied, are granted by Apple herein,
snej@25
    30
including but not limited to any patent rights that may be infringed by your
snej@25
    31
derivative works or by other works in which the Apple Software may be
snej@25
    32
incorporated.
snej@25
    33
snej@25
    34
The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
snej@25
    35
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
snej@25
    36
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
snej@25
    37
PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
snej@25
    38
COMBINATION WITH YOUR PRODUCTS.
snej@25
    39
snej@25
    40
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
snej@25
    41
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
snej@25
    42
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
snej@25
    43
ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
snej@25
    44
DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
snej@25
    45
CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
snej@25
    46
APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
snej@25
    47
snej@25
    48
Copyright (C) 2008 Apple Inc. All Rights Reserved.
snej@25
    49
snej@25
    50
*/
snej@25
    51
snej@25
    52
#import "HelloWorldAppDelegate.h"
snej@25
    53
#import "MyViewController.h"
snej@25
    54
snej@25
    55
snej@25
    56
@implementation HelloWorldAppDelegate
snej@25
    57
snej@25
    58
@synthesize window;
snej@25
    59
@synthesize myViewController;
snej@25
    60
snej@25
    61
snej@25
    62
- (void)applicationDidFinishLaunching:(UIApplication *)application {
snej@25
    63
	
snej@25
    64
	// Set up the view controller
snej@25
    65
	MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"HelloWorld" bundle:[NSBundle mainBundle]];
snej@25
    66
	self.myViewController = aViewController;
snej@25
    67
	[aViewController release];
snej@25
    68
    
snej@25
    69
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
snej@25
    70
	
snej@25
    71
	// Add the view controller's view as a subview of the window
snej@25
    72
	UIView *controllersView = [myViewController view];
snej@25
    73
	[window addSubview:controllersView];
snej@25
    74
	[window makeKeyAndVisible];
snej@25
    75
}
snej@25
    76
snej@25
    77
snej@25
    78
- (void)dealloc {
snej@25
    79
	[myViewController release];
snej@25
    80
	[window release];
snej@25
    81
	[super dealloc];
snej@25
    82
}
snej@25
    83
snej@25
    84
@end