ios - 奇怪的 iPad 旋转效果

标签 ios rotation

我有一个非常标准的 iPad 应用程序,它设置为仅横向显示。为了实现这一点,我将初始界面方向设置为横向,并将支持界面方向设置为单个横向左主页按钮,并将 shouldAutorotateToInterfaceOrientation 属性重写为以下内容:

 -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    BOOL b = UIInterfaceOrientationIsLandscape(interfaceOrientation);
    return b;
}

真正奇怪的是,当应用程序启动时,它是正确的,并且将 iPad 颠倒旋转没有任何反应,但是按下主页按钮旋转会旋转屏幕,但一旦旋转,它就永远不会旋转回来,所以认为这不是旋转设置。

有人遇到过这种情况吗?

最佳答案

来自文档:

#define UIInterfaceOrientationIsLandscape(orientation) \
   ((orientation) == UIInterfaceOrientationLandscapeLeft || \
   (orientation) == UIInterfaceOrientationLandscapeRight)

因此,如果您只想支持一种景观旋转,这不是正确的选择...

关于ios - 奇怪的 iPad 旋转效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7151390/

相关文章:

algorithm - 如何计算 (x, y) 点列表的(近似)旋转

cocos2d-iphone - 在 Sprite 外部的 anchor 上旋转 cocos2d Sprite

ios - CGAffineTransformMakeRotation 在 180 度(-3.14)后反方向

ios - 两个 CLLocationManager 相互干扰

ios - NSDateFormatter dateFromString 返回错误的日期

ios - CMAttitudeReferenceFrameXTrueNorthZVertical 不起作用

c# - 如何更改重叠框和小控件的方向?

ios - Google Maps SDK iOS 使用经度和纬度获取首都的简单方法

ios - 如何使用 ScrollView 单击列表部分内的项目以导航到详细信息页面 SwiftUI

java - 如何逆时针旋转 Canvas android一圈