title: Using UIViewController as overlay for UIImagePickerController (SWIFT)
body: <p>I'm trying to use view from an UIViewController as an overlay for a UIImagePickerController.</p>
  
  <p>If I make a UIView programmatically with a UIButton which triggers a takePicture() method of the UIImagePickerController, it works flawlessly.</p>
  
  <p>However, if I want to design the interface of my overlay in a new UIViewController and use its view in .cameraOverlayView, I don't know how to launch the UIImagePickerController actions from the overlay view controller.</p>
  
  <p>Here comes some code:</p>
  
  <pre><code>class CG_Camera: UIViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate{
  
      override func viewDidAppear(Bool) {
          setCam();
      }
      func setCam(){
          if(UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)) {
             self.cg_imgPicker.sourceType=UIImagePickerControllerSourceType.Camera;
             self.cg_imgPicker.showsCameraControls=false;
             self.cg_imgPicker.delegate=self;
  
             var miOverlayController:CG_Camera_Mask=self.storyboard.instantiateViewControllerWithIdentifier("cameraMask") as CG_Camera_Mask;
             self.cg_imgPicker.cameraOverlayView=miOverlayController.view;
             self.presentViewController(self.cg_imgPicker, animated: true, completion:nil);         
          }
      }
  }
  </code></pre>
  
  <p>I tried to create an IBButton outlet in the overlay view, add it's target to call a method from the parent UIViewController, but it crashes.</p>
  
  <pre><code>miOverlayController.takePicButton.hidden=true; //just a try to show you how it crashes accessing the outlet
  </code></pre>
  
  <p>//fatal error: unexpectedly found nil while unwrapping an Optional value</p>