123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- //
- // AppDelegate.m
- // FreeMusic
- //
- //
- #import "AppDelegate.h"
- #import "MCDataEngine.h"
- #import "Globle.h"
- #import "FMSingerModel.h"
- #import "FMMainViewController.h"
- #import "FMHomeViewController.h"
- #import "DBDaoHelper.h"
- #import "DownViewController.h"
- #import "QingXuViewController.h"
- @implementation AppDelegate
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- // Override point for customization after application launch.
- self.window.backgroundColor = [UIColor whiteColor];
- Globle * globle = [Globle shareGloble];
- [globle copySqlitePath];
- globle.isPlaying = YES;
- [DBDaoHelper createAllTable];
-
- self.mainViewController = [[FMMainViewController alloc] init];
- self.rootNavigationController = [[UINavigationController alloc] initWithRootViewController:self.mainViewController];
-
- self.homeViewController = [[FMHomeViewController alloc] init];
- self.homeNavigationController = [[UINavigationController alloc] initWithRootViewController:self.homeViewController];
-
- self.qingxuViewController = [[QingXuViewController alloc] init];
- self.qingxuNavigationController = [[UINavigationController alloc] initWithRootViewController:self.qingxuViewController];
-
- self.tudouViewController = [[DownViewController alloc] init];
- self.tudouNavigationController = [[UINavigationController alloc] initWithRootViewController:self.tudouViewController];
- self.tabBarController = [[UITabBarController alloc] init];
- self.tabBarController.viewControllers = [NSArray arrayWithObjects:self.homeNavigationController,self.qingxuNavigationController,self.rootNavigationController,self.tudouNavigationController, nil];
-
- self.homeNavigationController.tabBarItem.title = @"我的分类";
- self.homeNavigationController.tabBarItem.image = [UIImage imageNamed:@"mymusci"];
-
- self.qingxuNavigationController.tabBarItem.title = @"我的心情";
- self.qingxuNavigationController.tabBarItem.image = [UIImage imageNamed:@"tab_grzx_pres"];
-
- self.rootNavigationController.tabBarItem.title = @"明星列表";
- self.rootNavigationController.tabBarItem.image = [UIImage imageNamed:@"tabbarSearch"];
- self.tudouNavigationController.tabBarItem.title = @"本地下载";
- self.tudouNavigationController.tabBarItem.image = [UIImage imageNamed:@"tabbarMovie"];
- self.tabBarController.selectedViewController = self.rootNavigationController;
- self.window.rootViewController = self.tabBarController;
- [self.window makeKeyAndVisible];
- return YES;
- }
- -(void)addSingerToDB
- {
- long long uid = 60467713;//[[array objectAtIndex:index] longLongValue];
- MCDataEngine * engine = [MCDataEngine new];
- [engine getSingerInformationWith:uid WithCompletionHandler:^(NSArray *array) {
- } errorHandler:^(NSError *error) {
-
- }];
- }
- - (void)applicationWillResignActive:(UIApplication *)application
- {
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
- }
- - (void)applicationDidEnterBackground:(UIApplication *)application
- {
- //NSLog(@"程序已经进入后台...");
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
- [self becomeFirstResponder];
- [Globle shareGloble].isApplicationEnterBackground = YES;
- [[NSNotificationCenter defaultCenter] postNotificationName:FMRFRadioViewSetSongInformationNotification object:nil userInfo:nil];
- }
- //耳机线控代码
- /*- (void)remoteControlReceivedWithEvent:(UIEvent *)event
- {
- NSString * statu = nil;
- if (event.type == UIEventTypeRemoteControl) {
- switch (event.subtype) {
- case UIEventSubtypeRemoteControlPause:
- statu = @"UIEventSubtypeRemoteControlPause";
- break;
- case UIEventSubtypeRemoteControlPreviousTrack:
- statu = @"UIEventSubtypeRemoteControlPreviousTrack";
- break;
- case UIEventSubtypeRemoteControlNextTrack:
- statu = @"UIEventSubtypeRemoteControlNextTrack";
- break;
- case UIEventSubtypeRemoteControlPlay:
- statu = @"UIEventSubtypeRemoteControlPlay";
- break;
- default:
- break;
- }
- }
- NSMutableDictionary * dict = [NSMutableDictionary new];
- [dict setObject:statu forKey:@"keyStatus"];
- [[NSNotificationCenter defaultCenter] postNotificationName:FMRFRadioViewStatusNotifiation object:nil userInfo:dict];
- }*/
- - (void)applicationWillEnterForeground:(UIApplication *)application
- {
- // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
- }
- - (void)applicationDidBecomeActive:(UIApplication *)application
- {
- //NSLog(@"程序已经获得焦点...");
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- [Globle shareGloble].isApplicationEnterBackground = NO;
- }
- - (void)applicationWillTerminate:(UIApplication *)application
- {
- //NSLog(@"程序将要终止");
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- }
- @end
|