title: AVFoundation, cut off edges in the preview layer
body: <p>I am developing some iOS app, where I need to do some camera scanning. This is my first experience with AVFoundation, previously I developed camera apps with UIImagePickerController, but AVFoundation seems to be more powerful.</p>
  
  <p>The problem is that it cuts off edges in the preview layer, regardless of that I set preview layer's frame as big as view controller's one.</p>
  
  <p>This is my code:</p>
  
  <pre><code>AVCaptureSession *captureSession = [[AVCaptureSession alloc] init];
      AVCaptureDevice *photoCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
      NSError *error = nil;
      AVCaptureDeviceInput *videoInput = [AVCaptureDeviceInput deviceInputWithDevice:photoCaptureDevice error:&amp;error];
      if(videoInput){
          [captureSession addInput:videoInput];
          [captureSession startRunning];
          NSLog(@"ok");
      }   
      AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:captureSession];
      previewLayer.frame = self.view.bounds;
      NSLog(@"%f %f", previewLayer.frame.size.width, previewLayer.frame.size.height);
      [self.view.layer addSublayer:previewLayer];
  </code></pre>
  
  <p>Would be very thankful for a help,
  Artem</p>