希望有人可以帮助我。
我有一个imagepicker,照片被拍成肖像。然后我的图像显示在UIImageView中,其宽度大于使图像看起来错误的高度。如何在风景中的uiimageview中显示图片?是否可以在imageview中旋转图像?
我的imagepicker代码是:
func openCamera() {
if(UIImagePickerController .isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)) {
imagePicker.sourceType = UIImagePickerControllerSourceType.Camera
self .presentViewController(imagePicker, animated: true, completion: nil)
} else {
openGallary()
}
}
func openGallary() {
imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
self.presentViewController(imagePicker, animated: true, completion: nil)
} else {
popover=UIPopoverController(contentViewController: imagePicker)
}
}
internal func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
imageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage
let image = info[UIImagePickerControllerOriginalImage] as! UIImage
imageView.image = image
photoURL = saveImageToFile(image)
self.dismissViewControllerAnimated(true, completion: nil)
}