title: AVFoundation camera zoom
body: <p>I use <code>AVFoundation</code> framework to display video from camera.</p>
  <p>The code how i use it is usual:</p>
  <pre><code>session = [[AVCaptureSession alloc] init] ;
  ...   
  captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];
  ...
  [cameraView.layer addSublayer:captureVideoPreviewLayer];
  ...
  </code></pre>
  <p>So i want to add zoom function to camera.</p>
  <p>I have found 2 solutions how to implement zoom.</p>
  <p><em><strong>First</strong></em> : is to use <code>CGAffineTransform</code>:</p>
  <p><code>cameraView.transform = CGAffineTransformMakeScale(x,y);</code></p>
  <p><em><strong>Second</strong></em> :  is to put cameraView in the scroll view ,set up max and min scrolling and set this view as zooming view.</p>
  <pre><code>- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
  {
      return cameraView;
  }
  </code></pre>
  <p>What is the best way to make zooming better performance and quality? Are there any else solutions to make zoom? Maybe i missed some <code>AVFoundation</code> methods for zooming.</p>
  <p>Thank you.</p>