How can I change the image orientation when taking a photo using the image picker function. I am not trying to rotate the imageView. I just want the image taken to be displayed in the imageView upside down using the image orientation.
import UIKit
class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@IBOutlet var displayImage: UIImageView!
var currentImageView: UIImageView?
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let image = info[UIImagePickerControllerOriginalImage] as! UIImage
self.currentImageView?.image = image
self.dismiss(animated: true)
}
@IBAction func takePhoto(_ sender: Any) {
self.currentImageView = self.displayImage
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.camera;
imagePicker.allowsEditing = false
self.present(imagePicker, animated: true, completion: nil)
}}