let user crop image in iOS

隐身守侯 提交于 2019-12-08 07:31:18

问题


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!


回答1:


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)



回答2:


This is no built in function. The way to do it would be to take the image an get a frame around the portion of the image you want.

This question should help you



来源:https://stackoverflow.com/questions/9529743/let-user-crop-image-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!