UIImagePicker is always opening photos app in landscape mode while the controller is in portrait mode, and the device orientation is also portrait. Can anyone please help?
func actionSheet(_ actionSheet: UIActionSheet, didDismissWithButtonIndex buttonIndex: Int) {
if buttonIndex == 1 {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
let controller = UIImagePickerController.init()
controller.sourceType = UIImagePickerControllerSourceType.camera
controller.delegate = self
controller.allowsEditing = true
self.present(controller, animated: true, completion: { () -> Void in
})
}
}
else if buttonIndex == 2 {
let controller = UIImagePickerController.init()
controller.sourceType = UIImagePickerControllerSourceType.photoLibrary
controller.delegate = self
controller.allowsEditing = true
self.present(controller, animated: true, completion: { () -> Void in
})
}
}