“interfaceOrientation” is deprecated in iOS 8, How to change this method Objective C

后端 未结 5 1205
花落未央
花落未央 2020-12-07 19:39

I have downloaded a simpleCamera view from Cocoa Controls which use this method

- (AVCaptureVideoOrientation)orientationForConnection
{
    AVCaptureVideoOri         


        
5条回答
  •  时光说笑
    2020-12-07 20:19

    Getting the device orientation is not correct. For instance, the device might be in landscape mode, but a view controller that only supports portrait will remain in portrait.

    Instead, use this:

    [[UIApplication sharedApplication] statusBarOrientation]
    

    Another bonus is that it still uses the UIInterfaceOrientation enum, so very little of your code needs to change.

提交回复
热议问题