|
| 1 | +/* |
| 2 | +
|
| 3 | + File: MoviePlayerAppDelegate.m |
| 4 | +Abstract: A simple UIApplication delegate class that adds the MyMovieViewController |
| 5 | +view to the window as a subview. |
| 6 | + |
| 7 | + Version: 1.4 |
| 8 | + |
| 9 | +Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple |
| 10 | +Inc. ("Apple") in consideration of your agreement to the following |
| 11 | +terms, and your use, installation, modification or redistribution of |
| 12 | +this Apple software constitutes acceptance of these terms. If you do |
| 13 | +not agree with these terms, please do not use, install, modify or |
| 14 | +redistribute this Apple software. |
| 15 | + |
| 16 | +In consideration of your agreement to abide by the following terms, and |
| 17 | +subject to these terms, Apple grants you a personal, non-exclusive |
| 18 | +license, under Apple's copyrights in this original Apple software (the |
| 19 | +"Apple Software"), to use, reproduce, modify and redistribute the Apple |
| 20 | +Software, with or without modifications, in source and/or binary forms; |
| 21 | +provided that if you redistribute the Apple Software in its entirety and |
| 22 | +without modifications, you must retain this notice and the following |
| 23 | +text and disclaimers in all such redistributions of the Apple Software. |
| 24 | +Neither the name, trademarks, service marks or logos of Apple Inc. may |
| 25 | +be used to endorse or promote products derived from the Apple Software |
| 26 | +without specific prior written permission from Apple. Except as |
| 27 | +expressly stated in this notice, no other rights or licenses, express or |
| 28 | +implied, are granted by Apple herein, including but not limited to any |
| 29 | +patent rights that may be infringed by your derivative works or by other |
| 30 | +works in which the Apple Software may be incorporated. |
| 31 | + |
| 32 | +The Apple Software is provided by Apple on an "AS IS" basis. APPLE |
| 33 | +MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION |
| 34 | +THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS |
| 35 | +FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND |
| 36 | +OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. |
| 37 | + |
| 38 | +IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL |
| 39 | +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 40 | +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 41 | +INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, |
| 42 | +MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED |
| 43 | +AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), |
| 44 | +STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE |
| 45 | +POSSIBILITY OF SUCH DAMAGE. |
| 46 | + |
| 47 | +Copyright (C) 2011 Apple Inc. All Rights Reserved. |
| 48 | + |
| 49 | +
|
| 50 | +*/ |
| 51 | + |
| 52 | +#import "MoviePlayerAppDelegate.h" |
| 53 | +#import "MyMovieViewController.h" |
| 54 | + |
| 55 | +@implementation MoviePlayerAppDelegate |
| 56 | + |
| 57 | +@synthesize window; |
| 58 | +@synthesize tabBarController; |
| 59 | + |
| 60 | +- (void)applicationDidFinishLaunching:(UIApplication *)application |
| 61 | +{ |
| 62 | + /* Override point for customization after app. launch. */ |
| 63 | + |
| 64 | + /* Add the tab bar controller's current view as a subview of the window. */ |
| 65 | + [window addSubview:tabBarController.view]; |
| 66 | + [window makeKeyAndVisible]; |
| 67 | +} |
| 68 | + |
| 69 | +/* Tells the delegate that the application is about to enter the foreground. */ |
| 70 | +- (void)applicationWillEnterForeground:(UIApplication *)application |
| 71 | +{ |
| 72 | + MyMovieViewController *selectedViewController = (MyMovieViewController *)tabBarController.selectedViewController; |
| 73 | + if ([selectedViewController respondsToSelector:@selector(viewWillEnterForeground)]) |
| 74 | + { |
| 75 | + [selectedViewController viewWillEnterForeground]; |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +- (void)dealloc |
| 80 | +{ |
| 81 | + [window release]; |
| 82 | + [super dealloc]; |
| 83 | +} |
| 84 | + |
| 85 | + |
| 86 | +@end |
0 commit comments