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 25  
26 26 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
27 27 // Override point for customization after application launch.
  28 + [self restoreStatusBarOrientation];
28 29 [[UITabBar appearance] setTranslucent:NO];
  30 +
29 31 #pragma mark - 打包注意
30 32 // [AvoidCrash makeAllEffective];
31 33 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
... ... @@ -73,7 +75,6 @@
73 75 CNLiveENTabBarController *liveTab = [[CNLiveENTabBarController alloc] init];
74 76 self.window.rootViewController = liveTab;
75 77 }
76   -
77 78 [self.window makeKeyAndVisible];
78 79  
79 80 return YES;
... ... @@ -531,5 +532,20 @@
531 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 551 @end
... ...