我们可以知道 iPhone“人像方向锁定”是开/关吗

Posted

技术标签:

【中文标题】我们可以知道 iPhone“人像方向锁定”是开/关吗【英文标题】:Can we know iPhone "Portrait Orientation Lock" is On/Off 【发布时间】:2019-11-05 07:23:25 【问题描述】:

我想知道 iPhone 当前处于纵向模式还是横向模式。如果我强行打开“纵向模式”,那么就有办法以编程方式知道。

【问题讨论】:

这是您需要的东西吗? ***.com/a/38894646/3940673 我从***.com/questions/49164302/…得到了正确答案。 【参考方案1】:

您可以简单地使用orientation 来获取当前设备的方向,

UIDevice.currentDevice().orientation

要检查人像模式,您可以这样做,

if UIDevice.currentDevice().orientation == .portrait 
    //add your code here...

这些可能是orientation 值,

public enum UIDeviceOrientation : Int 
    case unknown
    case portrait // Device oriented vertically, home button on the bottom
    case portraitUpsideDown // Device oriented vertically, home button on the top
    case landscapeLeft // Device oriented horizontally, home button on the right
    case landscapeRight // Device oriented horizontally, home button on the left
    case faceUp // Device oriented flat, face up
    case faceDown // Device oriented flat, face down

【讨论】:

以上是关于我们可以知道 iPhone“人像方向锁定”是开/关吗的主要内容,如果未能解决你的问题,请参考以下文章

iPhone的刷机 iPhone进UDF

iPhone "debug and track"模式怎么关?

放大时,iPhone 5 上不显示 3d 地图

我们如何知道我们的应用程序是不是从 iPhone 上卸载? [关闭]

Spring Boot的应用启动与关闭

使用wireshark抓包之后就可以上网,高手请进