Reputation: 2797
I have UIActionSheet with 3 options -
I use UIImagePickerController and don't have problems with first 2 options. User choose photo and then can zoom/move to crop one.
So, my question is - how I can put already saved photo for editing (3rd option) with current scale factor and frame. F.e if I choose "edit photo" I want to get the same photo "state" that I've choosen after preview.
That is how native "contacts" app works!
Upvotes: 0
Views: 1181
Reputation: 33101
You need to access the UIImagePickerControllerEditedImage
object in your delegate method:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
if (!image) image = [info objectForKey:UIImagePickerControllerOriginalImage];
....
}
Then you can use this image in your own edit view controller. The Contacts app works this way because it writes the edited image back to the ALAsset
, a destructive change. It is probably a bad idea to do this for users in your app, so it is best to write your own edit image controller that will handle the edited image instead of UIImagePickerController
. A search on github shows tons of open-source repos that can help you with cropping here.
Upvotes: 1