Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Crop Size in UIImagePickerController

I've been struggling with this for awhile now, since there is little documentation on the subject. I have a UIImagePickerController in my iPhone application that I use to select an image to be applied as the background of a view later. This is easy enough to do. Unfortunately, if a user selects a large image from their camera roll it needs to be resized and cropped in order to look decent.

It's easy enough to toggle picker.allowsEditing to YES and get the image editor up, but the default crop dimensions are too small. I need to set it to the full dimensions of the iPhone screen (320 for the old models, 640 for the new). How do you do that? I've been Googling and looking at Apple's documentation, but I can't find anything. The best I found is a slightly buggy solution from 2009 (http://blog.stormyprods.com/2009/06/image-picker-sample.html) that almost works, but it shifts the image down about 20px. (Plus, it's a bit over-complicated.) Surely there's an elegant, simple solution that I'm missing?

like image 299
redwall_hp Avatar asked Sep 18 '10 03:09

redwall_hp


1 Answers

One year later - Hi, like you, i haven't found anything useful, so i created this Project - a custom size crop and zoom editing UIImagePicker Popover for the iPad.

You could easily change it for the iphone, hope that helps someone. Here it is - https://github.com/yogev77/UIImagePickerWithEditor

like image 51
Yogev Shelly Avatar answered Oct 07 '22 10:10

Yogev Shelly