Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImagePickerController always pics 640x640 image

When I present a UIImagePickerController in my iPhone App, it always comes up with a white square with a frame around it, and the user has can zoom in and out of an image and make it fit within the white square. Whatever they fit in the white square is what is returned to:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)info

and it is always 640x640.

Why can't the user select an entire image? Why does this white square even come up?

like image 998
CodeGuy Avatar asked Jan 23 '12 01:01

CodeGuy


2 Answers

Built in editing is very limited. Here is what the Apple documentation says:

Editing controls To specify whether the camera interface should offer the user controls for moving and scaling the captured picture, or for trimming the captured movie, set the allowsEditing property to YES (to provide editing controls) or to NO.

When using built-in editing controls, the image picker controller enforces certain options. For still images, the picker enforces a square cropping as well as a maximum pixel dimension. For movies, the picker enforces a maximum movie length and resolution. If you want to let the user edit full-size media, or specify custom cropping, you must provide your own editing UI.

like image 138
Twilite Avatar answered Nov 15 '22 14:11

Twilite


Make sure you're not enable editing for the UIImagePickerController. You just need this:

UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePicker setDelegate:self];
[controller presentModalViewController:imagePicker animated:YES];
[imagePicker release];
like image 43
YuAo Avatar answered Nov 15 '22 14:11

YuAo