如何在使用圖像選擇器功能拍攝照片時更改圖像方向。我不想旋轉imageView。我只是想要使用圖像方向將拍攝的圖像上下顛倒顯示在imageView中。如何更改imagePicker中的圖像方向(swift3)
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)
}}
currentImageView是不同imageViews的最佳值。它不是代碼的最佳用法,因爲只有1個imageView是displayImage。但在未來,我想使用多個imageViews。 –
我不想存儲圖像。我只是想改變圖像的方向。你能否詳細瞭解你難以理解的內容。謝謝。 –