当明确选择风景“右”时,应用程序左右旋转。 Xcode 7.2.1

时间:2016-02-26 03:48:04

标签: ios objective-c xcode7 uiinterfaceorientation

有人能告诉我为什么会这样吗?还有其他需要定义的地方吗?

//AppDelegate

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeRight;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    //return NO;
}

-(BOOL)shouldAutorotate {
    return NO;
}

enter image description here enter image description here

1 个答案:

答案 0 :(得分:0)

我在app appate中找到了另一种界面定位方法。感谢@ matt的评论,这让我更加难以理解。它正在返回景观,将其改为景观,现在一切都很好。

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if (([window.rootViewController.presentedViewController isKindOfClass:[UIImagePickerController class]]) && (window.rootViewController.presentedViewController.isBeingDismissed == NO)) {
    return UIInterfaceOrientationMaskPortrait;
}
//return UIInterfaceOrientationMaskLandscape;
return UIInterfaceOrientationMaskLandscapeRight;
}