让用户在iOS中裁剪图像 [英] let user crop image in iOS
本文介绍了让用户在iOS中裁剪图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
objective-c中是否有内置功能可以像iOS照片库中那样进行图像裁剪?我尝试过在UIImagePickerController中启用编辑功能,但操作不一样。谢谢!
Is there a built in function in objective-c to do image cropping like the one in iOS photo gallery? I have tried enabling editing in UIImagePickerController, but it doesn't do the same. Thanks!
推荐答案
有很多使用Core Graphics函数裁剪图像的方法,最基本的方法是:
there are quite a few ways to crop images using the Core Graphics functions, the most basic one would be:
CGRect cropRect = CGRectMake(0, 0, 100, 100);
CGImageRef cropped_img = CGImageCreateWithImageInRect(yourUIImage.CGImage, cropRect)
这篇关于让用户在iOS中裁剪图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文