gpt4 book ai didi

ios - swift ,让我在这个 : interfaceOrientation was deprecated in iOS 8. 0

转载 作者:可可西里 更新时间:2023-11-01 00:37:09 25 4
gpt4 key购买 nike

这不是生死攸关的事情,但我没有运气破解它。谢谢。

  if session.canAddInput(videoDeviceInput){

session.addInput(videoDeviceInput)

self.videoDeviceInput = videoDeviceInput

dispatch_async(dispatch_get_main_queue(), {

// ERROR HERE
let orientation: AVCaptureVideoOrientation = AVCaptureVideoOrientation(rawValue: self.interfaceOrientation.rawValue)!

(self.previewView.layer as! AVCaptureVideoPreviewLayer).connection.videoOrientation = orientation

})
}

enter image description here

最佳答案

是的,它被贬低了。您可以改用 UIApplication.sharedApplication().statusBarOrientation

let orientation: AVCaptureVideoOrientation?

switch UIApplication.sharedApplication().statusBarOrientation{
case .LandscapeLeft:
orientation = .LandscapeLeft
case .LandscapeRight:
orientation = .LandscapeRight
case .Portrait:
orientation = .Portrait
case .PortraitUpsideDown:
orientation = .PortraitUpsideDown
case .Unknown:
orientation = nil
}

if let orientation = orientation{
(self.previewView.layer as! AVCaptureVideoPreviewLayer).connection.videoOrientation = orientation
}

关于ios - swift ,让我在这个 : interfaceOrientation was deprecated in iOS 8. 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33738551/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com