image crop in ios using BJImageCropper

岁酱吖の 提交于 2019-12-10 22:04:44

问题


I am using BJImageCropper for image crop in iOS, but when I am touching on the image's last corner, it's automatically updating the height and width on the opposite side.

Example code is https://github.com/barrettj/BJImageCropper/zipball/master


回答1:


Get the commit I just pushed. Should be fixed there.




回答2:


That is a bug in the code. Contact the author to correct the errors :)




回答3:


You can use another option for croping Image that is ContextRect

A short Example of it is :

CGRect contextRect = CGRectMake(50, 50, 200, 200);

UIGraphicsBeginImageContext(contextRect.size);

[self.view.layer renderInContext : UIGraphicsGetCurrentContext()];

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

CGImageRef imageRef = CGImageCreateWithImageInRect([viewImage CGImage], contextRect);

UIImage * savedImage = [UIImage imageWithCGImage:imageRef scale:1.0 orientation:viewImage.imageOrientation];

You can edit the x,y origin and width n height of the view according to your image.



来源:https://stackoverflow.com/questions/11951268/image-crop-in-ios-using-bjimagecropper

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