I use the AVFoundation framework to display video from the camera.
The code, as I use it, is usually:
session = [[AVCaptureSession alloc] init] ; ... captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; ... [cameraView.layer addSublayer:captureVideoPreviewLayer]; ...
So, I want to add a zoom function to the camera.
I found 2 solutions on how to implement scaling.
First : use CGAffineTransform :
cameraView.transform = CGAffineTransformMakeScale(x,y);
Second : you need to place the CameraView in the scroll view, configure the scrolling of max and min, and set this view to scale.
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return cameraView; }
What is the best way to increase productivity and quality? Are there any other solutions to increase? I might have skipped some AVFoundation methods for scaling.
Thanks.
BS
source share