I'm using the UIImagePickerController to take and edit a picture. it works fine in landscape, but in portrait it will crop the picture into a square (does not allow to reduce the image to fit fully into the square crop field like in landscape. Any ideas?
code:
-(IBAction)initCamera:(id)sender{
//Init imagePicker instance
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setDelegate:self];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setShowsCameraControls:YES];
[imagePicker setAllowsEditing:YES];
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];
}
Check out GKImagePicker library, it allows to set your custom image crop area, like this:
self.imagePicker = [[GKImagePicker alloc] init];
self.imagePicker.cropSize = CGSizeMake(320, 90);
self.imagePicker.delegate = self;
[self presentModalViewController:self.imagePicker.imagePickerController animated:YES];
I know its really late to answer this question, But someone may find this helpful.
Change
[imagePicker setAllowsEditing:YES];
To
[imagePicker setAllowsEditing:NO];
Thanks, Jay
You can provide a custom cropping UI, but there is no way to change just the cropping rectangle of the standard one.
This link might help with that.
来源:https://stackoverflow.com/questions/9362712/uiimagepickercontroller-crops-picture-to-square-in-portrait