ghostrider
ghostrider

Reputation: 5259

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?

Upvotes: 10

Views: 351

Answers (1)

Steve Wilford
Steve Wilford

Reputation: 9002

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.

Upvotes: 1

Related Questions