How to remove square ratio cropping for images on IOS

Zhen picture Zhen · Apr 13, 2012 · Viewed 16k times · Source

I am using the IOS standard image cropping functionality (move and scale) to crop my image before submitting it to the server.

However, I realize that the cropping provided has a square ratio (see screenshot below)

enter image description here

Snippet of the code is as follows:

//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 can allow 'move and scale' editing and at the same time allow the user to do cropping WITHOUT the square ratio restriction?

Answer

Alex picture Alex · Sep 11, 2014

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