How to remove cropping a square ratio for images on iOS

I use the standard iOS image cropping function (move and zoom) to crop the image before sending it to the server.

However, I understand that the provided crop has a square ratio (see screenshot below)

enter image description here

The following is a snippet of code:

//set up image picker self.imgPicker = [[[UIImagePickerController alloc] init]autorelease]; self.imgPicker.allowsEditing = YES; self.imgPicker.delegate = self; //Trigger get photo from library function self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [self presentModalViewController:self.imgPicker animated:YES]; 

How to allow editing "move and zoom" and at the same time allow the user to crop without the limitation of the square ratio?

+8
ios uiimagepickercontroller crop square
source share
3 answers

I think you need to change self.imgPicker.allowsEditing = YES; on self.imgPicker.allowsEditing = NO;

+10
source share

This library can help you.

https://github.com/gekitz/GKImagePicker

It supports custom cropping and integrates seamlessly with the native builder if necessary.

+3
source share

I think this will serve your purpose. You can change the restrictions as you wish.

https://github.com/kishikawakatsumi/PEPhotoCropEditor?source=cc

0
source share

All Articles