Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imagePickerController move and scale does not work

Here is my code:

-(void) takePhoto
{
    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    //imagePickerController.editing = YES;
    imagePickerController.allowsEditing=YES;
    imagePickerController.delegate = self;

    [self presentViewController:imagePickerController animated:YES completion:NULL];
}

#pragma mark - Image picker delegate methods
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissViewControllerAnimated:NO completion:nil];

    [self.Picture setImage:[info objectForKey:UIImagePickerControllerOriginalImage]];


}

and I have implemented the delegates

UINavigationControllerDelegate,UIImagePickerControllerDelegate

The image is taken, I can see the move and scale box, but when I move it the box returns to the initial position - likes it bounces back.

Why is that?

like image 884
ghostrider Avatar asked Oct 11 '13 22:10

ghostrider


1 Answers

Looks like this is caused because you are requesting the UIImagePickerControllerOriginalImage, according to the documentation this returns "the original, uncropped image selected by the user."

Try changing this to UIImagePickerControllerEditedImage.

https://developer.apple.com/library/ios/documentation/uikit/reference/UIImagePickerControllerDelegate_Protocol/UIImagePickerControllerDelegate/UIImagePickerControllerDelegate.html#//apple_ref/doc/constant_group/Editing_Information_Keys

Edit: Actually after re-reading the question a couple of times if the problem is occurring in the picker itself this probably won't help.

like image 187
Steve Wilford Avatar answered Oct 26 '22 22:10

Steve Wilford