我读到它是自动的,但在我的情况下似乎并没有发生。使用UIImagePickerController并将allowsEditing设置为YES,我将获得带有裁剪方覆盖的编辑视图,但是当我完成图像处理时,它不会像我预期的那样被裁剪。
在这个阶段应该是自动的吗?如果不是,在默认视图提供的匹配区域中裁剪图像的好解决方案是什么?
谢谢。
发布于 2013-08-16 20:02:29
您可能对信息字典使用了错误的键:UIImagePickerControllerOriginalImage
。要获得裁剪(是的,它是自动的)图像,您必须使用UIImagePickerControllerEditedImage
键。
这应该能起作用:
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *pickedImageEdited = [info objectForKey:UIImagePickerControllerEditedImage];
//dismiss the picker and process the image...
}
https://stackoverflow.com/questions/18281099
复制相似问题