gpt4 book ai didi

ios - UIImagePickerController 裁剪?

转载 作者:可可西里 更新时间:2023-11-01 04:23:46 30 4
gpt4 key购买 nike

我读到它是自动的,但在我的案例中似乎没有发生。使用 UIImagePickerController 并将 allowsEditing 设置为 YES 我得到了带有裁剪方形叠加层的编辑 View ,但是当我完成图像处理时,它并没有像我预期的那样被裁剪。

在这个阶段它应该是自动的吗?如果不是,在默认 View 提供的匹配区域中裁剪图像的好的解决方案可能是什么?

谢谢。

最佳答案

您可能对信息字典使用了错误的键:UIImagePickerControllerOriginalImage。要获得裁剪(是的,它是自动的)图像,您必须使用 UIImagePickerControllerEditedImage 键。

这应该可以解决问题:

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *pickedImageEdited = [info objectForKey:UIImagePickerControllerEditedImage];

//dismiss the picker and process the image...
}

关于ios - UIImagePickerController 裁剪?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18281099/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com