Landscape Apps Xcode 5 / iOS 7

跟風遠走 提交于 2019-12-11 03:17:14

问题


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

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

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

//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);
}

回答1:


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.



来源:https://stackoverflow.com/questions/18857964/landscape-apps-xcode-5-ios-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!