【发布时间】:2017-06-02 01:43:28
【问题描述】:
我正在使用 UIImagePicker 让用户拍照。拍摄照片时,我希望他们平移和缩放图像以适应裁剪框,以便图像存储为正方形。
但是,在裁剪图像时,您似乎无法将其移动到(纵向)图像的顶部和底部(如果是横向则为左侧和右侧)。
我尝试过搜索,但似乎没有太多信息,但这似乎是一个大问题。
有人可以帮忙吗?
这是我正在使用的极少量代码:
let imagePicker = UIImagePickerController()
imagePicker.allowsEditing = true
imagePicker.sourceType = UIImagePickerControllerSourceType.camera
present(imagePicker, animated: true, completion: nil)
显然还有更多代码,但这是主要部分。
用照片编辑:
所以我希望能够移动/放大照片以选择要保存的任何正方形部分。但是,我无法将它从这个位置移动/一直弹回来。
我可以放大,但它仍然限制我从顶部和底部边缘。
同样,它适用于照片库。
【问题讨论】:
-
让 myPickerController = UIImagePickerController() myPickerController.delegate = self; myPickerController.allowsEditing = true myPickerController.sourceType = UIImagePickerControllerSourceType.Camera self.presentViewController(myPickerController, animated: true, completion: nil)
-
你是在告诉我将委托设置为自我吗?因为我已经这样做了
-
您检查的是哪个设备? iphone 6 还是别的?
-
它只需要适用于iPhone 5S
-
这是自 iOS 6 以来的一个错误,看起来他们出于某种原因不会修复它。我建议使用替代方法,例如 github.com/justwudi/WDImagePicker。另请查看 2012 年的这篇帖子,其中包含相同的错误:stackoverflow.com/questions/12630155/…
标签: ios swift xcode uiimage uiimagepickercontroller