J'ai une application qui permet à un utilisateur de prendre une photo avec l'appareil photo. Je voudrais seulement permettre à l'utilisateur de prendre des photos de paysage, pas de portrait. Y a-t-il un moyen pour moi de verrouiller l'orientation de la caméra?Verrouiller la caméra en orientation paysage
est Ci-dessous le code J'utilise:
func takePhoto() {
//If a camera is available on this device, go to camera. If not, present an error message.
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
//Create the image picker controller
imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .Camera
//Present the camera view
presentViewController(imagePicker, animated: true, completion: nil)
}
else {
let alert = UIAlertController(title: "Error", message: "There is no camera available", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(alertAction) in alert.dismissViewControllerAnimated(true, completion: nil)}))
self.presentViewController(alert, animated: true, completion: nil)
}
}