iOS 6中不推荐使用方向 [英] Orientation deprecated in iOS 6

查看:119
本文介绍了iOS 6中不推荐使用方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来avcapturevideopreviewlayer的方向已在iOS 6中折旧。任何人都知道新代码?这是我目前的(折旧)代码:

Looks like orientation for avcapturevideopreviewlayer has been depreciated in iOS 6. Anyone know the new code? Here is my current (depreciated) code:

[self setPreviewLayer:[[AVCaptureVideoPreviewLayer alloc] initWithSession:[self captureSession]]];
[[self previewLayer] setVideoGravity:AVLayerVideoGravityResizeAspectFill];
previewLayer.orientation = UIInterfaceOrientationLandscapeRight;


推荐答案

您检查过文档了吗?它只有一行:

Did you check the documentation? It's only one line:


图层的方向。 (在iOS 6.0中已弃用。使用 videoOrientation
(AVCaptureConnection)代替。)

The layer’s orientation. (Deprecated in iOS 6.0. Use videoOrientation (AVCaptureConnection) instead.)

所以使用:

[[AVCaptureVideoPreviewLayer connection] setVideoOrientation: AVCaptureVideoOrientationLandscapeRight];

AVCaptureVideoPreviewLayer.connection.videoOrientation= AVCaptureVideoOrientationLandscapeRight;

这篇关于iOS 6中不推荐使用方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆