![](/img/trans.png)
[英]dismissmodalviewcontrolleranimated is deprecated first deprecated in ios 6
[英]isOrientationSupported is deprecated in IOS
我收到此錯誤,我不知道如何解決它..
WARNING: -[<AVCaptureVideoPreviewLayer: 0xad482c0> isOrientationSupported] is deprecated. Please use AVCaptureConnection's -isVideoOrientationSupported
然而,當我看到蘋果文檔時,它說這是一個Mac OS功能..而不是IOS ...所以我有點困惑...期待得到一些答案..謝謝..
一些示例代碼也適用於6.0之前的版本:
if ([captureVideoPreviewLayer respondsToSelector:@selector(connection)])
{
if ([captureVideoPreviewLayer.connection isVideoOrientationSupported])
{
[captureVideoPreviewLayer.connection setVideoOrientation:self.interfaceOrientation];
}
}
else
{
// Deprecated in 6.0; here for backward compatibility
if ([captureVideoPreviewLayer isOrientationSupported])
{
[captureVideoPreviewLayer setOrientation:self.interfaceOrientation];
}
}
AVCaptureConnection
也是可用的iOS 這里 。 你可能看錯了文檔。
上面回答的示例代碼工作正常。 但需要取代自我。 interfaceOrientation with AVCaptureVideoOrientation。
編輯代碼如下。
if ([captureVideoPreviewLayer.connection isVideoOrientationSupported])
{
[captureVideoPreviewLayer.connection setVideoOrientation:AVCaptureVideoOrientationPortrait];
}
根據要求,方向將為縱向或橫向。
歡迎編輯和建議。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.