Commit fdc9796d694804e6d8d48ab5d806344c4b45bbb9

Authored by zhangxiaowen
1 parent 29fb7992

横屏问题

Showing 1 changed file with 17 additions and 1 deletions
CNLiveScioLive/AppDelegate.m
@@ -25,7 +25,9 @@ @@ -25,7 +25,9 @@
25 25
26 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 26 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
27 // Override point for customization after application launch. 27 // Override point for customization after application launch.
  28 + [self restoreStatusBarOrientation];
28 [[UITabBar appearance] setTranslucent:NO]; 29 [[UITabBar appearance] setTranslucent:NO];
  30 +
29 #pragma mark - 打包注意 31 #pragma mark - 打包注意
30 // [AvoidCrash makeAllEffective]; 32 // [AvoidCrash makeAllEffective];
31 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 33 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
@@ -73,7 +75,6 @@ @@ -73,7 +75,6 @@
73 CNLiveENTabBarController *liveTab = [[CNLiveENTabBarController alloc] init]; 75 CNLiveENTabBarController *liveTab = [[CNLiveENTabBarController alloc] init];
74 self.window.rootViewController = liveTab; 76 self.window.rootViewController = liveTab;
75 } 77 }
76 -  
77 [self.window makeKeyAndVisible]; 78 [self.window makeKeyAndVisible];
78 79
79 return YES; 80 return YES;
@@ -531,5 +532,20 @@ @@ -531,5 +532,20 @@
531 [[UIApplication sharedApplication] openURL:url]; 532 [[UIApplication sharedApplication] openURL:url];
532 } 533 }
533 } 534 }
  535 +- (BOOL)shouldAutorotate {
  536 + return NO;
  537 +
  538 +}
534 539
  540 +- (void)restoreStatusBarOrientation {
  541 + if ([[UIApplication sharedApplication] respondsToSelector:@selector(setStatusBarOrientation:)]) {
  542 + SEL selector = NSSelectorFromString(@"setStatusBarOrientation:");
  543 + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIApplication instanceMethodSignatureForSelector:selector]];
  544 + UIDeviceOrientation orentation = UIDeviceOrientationPortrait;
  545 + [invocation setSelector:selector];
  546 + [invocation setTarget:[UIApplication sharedApplication]];
  547 + [invocation setArgument:&orentation atIndex:2];
  548 + [invocation invoke];
  549 + }
  550 +}
535 @end 551 @end