How I could change the device orientation to Portrait with code?
In order to open the camera and library in portrait from the view controller.
I would like to include in this button:
@IBAction func openCamera(sender: AnyObject) { ///accion del boton Camara
// Create image picker controller let image = UIImagePickerController() image.delegate = self image.sourceType = UIImagePickerControllerSourceType.Camera image.cameraDevice = UIImagePickerControllerCameraDevice.Front self.presentViewController(image, animated: true, completion: nil) }
I got this error:
Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PLUICameraViewController shouldAutorotate] is returning YES' *** First throw call stack: (0x18150ee38 0x180b73f80 0x18150ed80 0x1866d1af0 0x1866db150 0x1866db0c8 0x1866d9bb0 0x186653910 0x1866536ac 0x1866536ac 0x1866536ac 0x186652c40 0x181e40d50 0x186652ac4 0x186660578 0x18675a11c 0x186759a40 0x1869b8740 0x18690afd8 0x186918990 0x18664a4a4 0x1814c47b0 0x1814c2554 0x1814c2984 0x1813ecd10 0x182cd4088 0x1866c1f70 0x1000675ac 0x180f8a8b8) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
When I use
> presentViewController(cameraViewController, animated: true,
> completion: nil)
> }
> */
>
> // Create image picker controller
>
>
> let image = UIImagePickerController()
>
> image.delegate = self
>
> image.sourceType = UIImagePickerControllerSourceType.Camera
> image.cameraDevice = UIImagePickerControllerCameraDevice.Front
> self.presentViewController(image, animated: true, completion: nil)
> }