1

AVCaptureVideo の向きを設定すると、何かがわかりません。私が使用する場合:

captureVideoPreviewLayer.orientation = UIInterfaceOrientationLandscapeLeft;- このメソッドは iOS 6.0 では非推奨であるという警告が表示されます。

だから私はこれを使用します:

[[captureVideoPreviewLayer connection]setVideoOrientation:AVCaptureVideoOrientationLandscapeLeft];- iOS 6.0 では問題なく動作しますが、iOS 6.0 未満ではクラッシュします。

できるだけ多くの iOS と互換性を持たせるにはどうすればよいですか? あなたはそれがきれいな解決策だと思いますか?

#define SYSTEM_VERSION_LESS_THAN(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)

if(SYSTEM_VERSION_LESS_THAN(@"6.0")){
    captureVideoPreviewLayer.orientation = UIInterfaceOrientationLandscapeLeft;
}
else{
    [[captureVideoPreviewLayer connection] setVideoOrientation:AVCaptureVideoOrientationLandscapeLeft];
}

前もって感謝します!

4

0 に答える 0