How to check if device orientation is landscape left or right in swift?

前端 未结 7 1080
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 21:22
    if UIDeviceOrientationIsLandscape(UIDevice.currentDevice().orientation) {
        print(\"landscape\")
    }
    if UIDeviceOrientationIsPortrait(UIDevice.currentDev         


        
相关标签:
7条回答
  • 2021-02-03 22:07

    UIDeviceOrientation will return a value for that:

       enum UIDeviceOrientation : Int {
            case Unknown
            case Portrait
            case PortraitUpsideDown
            case LandscapeLeft
            case LandscapeRight
            case FaceUp 
            case FaceDown
        }
    
    0 讨论(0)
提交回复
热议问题