[英]Cant detect orientation on the ios simulator?
I tried : 我试过了 :
if UIDevice.current.orientation == UIDeviceOrientation.portraitUpsideDown {
print ("UpsideDown")
}
I have rotated the simulator UpsideDown ,but It looks like the simulator cant catch that. 我已经将模拟器旋转了UpsideDown,但是看起来模拟器无法抓住它。 I dont know if this works in real device .. I have no device to test that. 我不知道这是否可以在真实设备中工作。我没有设备可以测试。 Is this a simulator bug ? 这是模拟器错误吗? what can I do to detect the orientation ? 如何检测方向?
By default when xcode creates your project, it doesn't enable portrait upside down orientation. 默认情况下,当xcode创建您的项目时,它不会启用纵向颠倒方向。 You can enable the same in Build Settings
-> Deployment Info
-> Device Orientation
. 您可以在Build Settings
> Deployment Info
> Device Orientation
启用相同的Build Settings
。 Please see below the screenshot: 请看下面的截图:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.