title: I can't fix size AVcapture with this code
body: <p>I need to fix screen capture on horizontal But this my code can't fix size screen capture follow code >   <strong>previewLayer.frame = CGRectMake(20, 40, 500, 100)</strong>.<br>
  see on below this screen picture not match with <strong>CGRectMake(20, 40, 500, 100)</strong>. </p>
  
  <p><a href="http://i.stack.imgur.com/0odgX.jpg" rel="nofollow">This is small size not match follow code(CGRectMake(20, 40, 500, 100))</a></p>
  
  <p>please let my idea or example code for custom size this thank you.</p>
  
  <p>This some code</p>
  
  <pre><code>import UIKit
  import AVFoundation
  
  protocol BarcodeDelegate {
      func barcodeReaded(barcode: String)
  }
  
  
  class barcodeCapViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate {
  
      var delegate: BarcodeDelegate?
      var captureSession: AVCaptureSession!
      var code: String?
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          self.captureSession = AVCaptureSession();
  
          let videoCaptureDevice: AVCaptureDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo)
  
          do {
  
              let videoInput = try AVCaptureDeviceInput(device: videoCaptureDevice)
  
              if self.captureSession.canAddInput(videoInput) {
                  self.captureSession.addInput(videoInput)
              } else {
                  print("Could not add video input")
              }
  
              let metadataOutput = AVCaptureMetadataOutput()
              if self.captureSession.canAddOutput(metadataOutput) {
                  self.captureSession.addOutput(metadataOutput)
  
                  metadataOutput.setMetadataObjectsDelegate(self, queue: dispatch_get_main_queue())
                  metadataOutput.metadataObjectTypes = [AVMetadataObjectTypeQRCode, AVMetadataObjectTypeEAN13Code]
              } else {
                  print("Could not add metadata output")
              }
  
              let previewLayer = AVCaptureVideoPreviewLayer(session: self.captureSession)
              previewLayer.frame = CGRectMake(20, 40, 500, 100)
              self.view.layer .addSublayer(previewLayer)
              self.captureSession.startRunning()
          } catch let error as NSError {
              print("Error while creating vide input device: \(error.localizedDescription)")
          }
  
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  
      func captureOutput(captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [AnyObject]!, fromConnection connection: AVCaptureConnection!) {
          for metadata in metadataObjects {
              let readableObject = metadata as! AVMetadataMachineReadableCodeObject
              let code = readableObject.stringValue
              if !code.isEmpty {
                  self.captureSession.stopRunning()
                  self.dismissViewControllerAnimated(true, completion: nil)
                  self.delegate?.barcodeReaded(code)
              }
          }
      }
  
  }
  </code></pre>