user1645721
user1645721

Reputation: 653

How to implement move scale photo option for edit photo just like in contacts add photo option

In my iPhone app i have add photo option, in that i added photos from library as well as captured images also..

When i open image picker to add/capture image it just display retake & use photo.

When i tapped on use it displays as it is image in image view

but i need to display my selected crop, just like add photo in contacts app in iphone

I did it by set self.imagePickerController.allowsEditing = YES;

But whenever i want to edit the image, i need to get back the original image but not the scaled/cropped image in the image picker to edit again

Upvotes: 0

Views: 567

Answers (1)

Shanmugaraja G
Shanmugaraja G

Reputation: 2778

You do have to set allowEditing of UIImagePickerController to YES, Try the below:

- (IBAction)takePicture:(id)sender {
UIImagePickerController *imagePicer = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
    [imagePicer setSourceType:UIImagePickerControllerSourceTypeCamera];
} else {
    [imagePicer setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}

// This will sets the editing mode after taking of picking image from image picker

[imagePicer setAllowsEditing:YES];
[imagePicer setDelegate:self];

//place image picker on the screen
[self presentViewController:imagePicer animated:YES completion:nil];
}

If you want to use the image that after editing, please change "UIImagePickerControllerOriginalImage" to "UIImagePickerControllerEditedImage", that's it!!

Upvotes: 1

Related Questions