Reputation: 37
i have an image view, the image view will get image from camera but the problem is when i want to display the image view the orientation of the image is landscape. here is my code
class ResultViewController: UIViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate {
var userData2 = userData()
var base64String1: String!
var decodedData1: Data!
var decodedImage1: UIImage!
@IBOutlet weak var imageResult: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
base64String1 = userData2.fotoIDString!
decodedData1 = Data(base64Encoded: base64String1, options: [])!
decodedImage1 = UIImage(data: decodedData1)!
imageResult.image = decodedImage1
}
Upvotes: 0
Views: 3242
Reputation: 1025
This following code rotate an image 90 degrees in Swift 3
imageResult.transform = CGAffineTransform(rotationAngle: .pi/2)
Upvotes: 1
Reputation: 433
You need to transfor orientation of your imageView
imageResult.transform = CGAffineTransformMakeRotation(M_PI_2);
Upvotes: 2