iPhone 如何设置 View 倒置模式

标签 iphone xcode ios xcode4

我们开发了一个纵向模式的应用程序,不支持加速度计。

为了可用性,我们需要将应用程序旋转 180º,因此我们需要应用程序处于颠倒模式。我们检查 xib 属性,如果我们发现一些神奇的东西来实现它......没办法

有线索吗?有帮助吗?

提前致谢

最佳答案

正如 Steven Kramer 所说,在您的 View Controller 中定义它:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
    return YES to allow it or NO to forbid it
if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
    return YES to allow it or NO to forbid it
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)
    return YES to allow it or NO to forbid it
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
    return YES to allow it or NO to forbid it
return NO; // Unknown value
}

例如,如果您只想接受横向模式,请使用

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}

仅对于纵向,使用return UIInterfaceOrientationIsPortrait(toInterfaceOrientation);

关于iPhone 如何设置 View 倒置模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5990569/

相关文章:

iphone - Swift 中的字典没有给出正确的响应

iphone - 在 iOS 中暂停时启动 locationManager

iOS 9 Spritekit 双击在 iPhone 6S 上不起作用

ios - 如何在iOS中使用AVAsset合并多个视频?

iphone - 自定义 MKPinAnnotation 标注气泡类似于默认标注气泡

iphone - 更改自定义对象上的 NSDate?

ios - 如何使用引号括起的 NSString 子字符串插入 NSArray

ios - 一周工作日的 EKRecurrenceRule

ios - 如何比较在 Objective-C 中声明为 id<protocol> 的实例

ios - UIScrollView 像 Mobile Safari 选项卡一样水平分页