gpt4 book ai didi

ios - iPad 方向无法正常工作

转载 作者:行者123 更新时间:2023-11-29 04:09:40 25 4
gpt4 key购买 nike

我发布了一个应用程序,但由于某种原因,只有一些人在使用该应用程序时遇到方向问题。也就是说,它以纵向模式打开,并且从此处不可旋转,因为应用程序设置为仅允许在 LandscapeLeft 和 LandscapeRight 中使用。大多数人都没有遇到这个问题,但是我最近通过我们的支持页面收到了一些投诉。

遇到此问题的人似乎使用的是 iOs 5.1 和 iPad gen 1,这是我的应用支持的最低操作系统。

这是处理旋转的代码:

   - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
return YES;
}
else
{
return NO;
}
}

这是 .plist

http://tinypic.com/r/nnvfhz/6

任何建议都会很棒。

最佳答案

在 iOS5 中,您必须重写 shouldAutorotateToInterfaceOrientation: 方法:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// support all interface orientations
return YES;
}

从 iOS 6 开始,此方法已被弃用,为此您应该使用以下方法:

- (BOOL)shouldAutorotate {
// return whether autorotation is supported
return TRUE;
}
- (NSUInteger)supportedInterfaceOrientations {
// return the mask that represents the supported interface orientations
return UIInterfaceOrientationMaskAll;
}

最后,我会提到这个方法,因为它经常适用:

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
// set the preferred orientation of view controllers presented in full-screen
return UIInterfaceOrientationLandscapeRight;
}

关于ios - iPad 方向无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14617299/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com