0

I added UIScreen bounds code in AppDelegate.m for iPhone 6 and now device orientation for iPhone 6 won't work for Portrait/ Upside Down. Upside Down is what's not working in simulator and devices.

Code in AppDelegate.m

 CGSize iosScreenSize = [[UIScreen mainScreen] bounds].size;

    if (iosScreenSize.height == 667) {

        UIStoryboard *iPhone6 = [UIStoryboard storyboardWithName:@"iPhone6" bundle:nil];

        UIViewController *initialViewController =[iPhone6 instantiateInitialViewController];

        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]bounds]];

        self.window.rootViewController = initialViewController;

        [self.window makeKeyAndVisible];
    }

When I included the above code the simulator and device for iPhone 6 doesn't detect Upside Down orientation. I also used nativeBounds and screenBounds, didn't work either for Upside Down orientation.

My code for device orientation...

 -(NSUInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
 }

I have no idea what to do to get AppDelegate code to let UpSide Down orientation be detected for iPhone 6.

Jet
  • 555
  • 1
  • 7
  • 19

1 Answers1

0

OK, finally figured this one out.

Then realized someone posted the answer here: Setting device orientation in Swift iOS

Go down to DaRk-_-D0G's answer.

I had to subclass my tab bar controller just to override that method. Very obnoxious .

Community
  • 1
  • 1
Shaolo
  • 1,180
  • 11
  • 13