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