ImagePickerController 裁剪问题 [英] Issue with ImagePickerController cropping

查看:45
本文介绍了ImagePickerController 裁剪问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望用户能够通过 ImagePickerController 裁剪他们从照片库中选择的图像.

I'd like user to be able to crop images they've selected from photo library via ImagePickerController.

我允许编辑.

self.imgPicker.allowsEditing = true

并检索图像的编辑版本.

And retrieve edited version of image.

let img = info[UIImagePickerControllerEditedImage] as? UIImage

图像顶部未完全裁剪.这是苹果的代码.我需要实现一些自定义的东西吗?

The top of the image is not fully cropped. This is Apples code. Do I need to implement something custom?

Crop(应该只显示图像,所有白色都被裁剪掉):

Crop (should only show image, all white is cropped out):

结果:

推荐答案

这是当您单击相机中的图片时的默认行为,此问题不会出现,但是当您从照片库中选择图片时,它就会出现.

It's a default behavior when you click picture from the camera this issue won't arise but when you pick a picture from the photo gallery it will be there.

你总是可以在你的情况下使用替代方案,我建议 YPImagePicker

You can always use the alternative in your case I would suggest YPImagePicker

或者您可以手动裁剪图像参考此LINK

OR you can crop the image manually refer this LINK

希望能帮到你.

这篇关于ImagePickerController 裁剪问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆