如何在AVCaptureVideoPreviewLayer Objective-c中获得缩放功能?

时间:2018-10-10 06:29:30

标签: objective-c avcapturesession

如何向AVCaptureVideoPreviewLayer添加缩放功能和滤镜?

  • (无效)loadView

{

self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

self.view.backgroundColor = [UIColor blackColor];

AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:_captureSession];
previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
previewLayer.frame = self.view.bounds;
[[self.view layer] addSublayer:previewLayer];
[self.view addSubview:[self createOverlay]];
_activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
_activityIndicator.center = self.view.center;

[self.view addSubview:_activityIndicator];
[_activityIndicator startAnimating];

}

0 个答案:

没有答案