Landscape Apps Xcode 5 / iOS 7
Asked Answered
H

1

2

I have a piano app in the App Store. It works in landscape mode.

enter image description here

Now iOS 7 appears to be ignoring the Landscape setting in IB

enter image description here

The app works as expected in iOS 6 and below, in landscape. In iOS 7 appears in portrait. Here are settings and relevant code:

enter image description here enter image description here

//iOS 6+
- (BOOL)shouldAutorotate
{
    return YES;
}

//iOS 6+
- (NSUInteger)supportedInterfaceOrientations
{
    return (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight);
}
//iOS 5.1.1-
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
        return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Hamartia answered 17/9, 2013 at 19:9 Comment(3)
What type of VC is your root VC for your application?Uncle
@Uncle UINavigationControllerHamartia
Note that the "simulated metrics" controls you point out in your screenshot only affect the view's appearance in that Interface Builder editor. (That's why it says "simulated".) The IB editor manages only the view itself -- at run time, things like status bar, orientation, and navigation bars are managed outside of the view (by view controllers or the app delegate). Since those things aren't present in the xib you're editing, the "simulated metrics" are there to let you edit the view as you expect it to appear at run time.Friendship
H
6

Thanks to @shawnwall comment I realised I didn't have a Root View Controller. In the past my app given support yo iOS 3.1.3 O_O:

[self.window addSubview:self.viewController.view];

I dropped 3.1.3 support a long time ago, so I can set up a root view controller:

self.window.rootViewController = self.viewController;

That was the thing that caused the visual bug.

Hamartia answered 17/9, 2013 at 19:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.