10

这是我的代码:

-(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]];


}

我已经实施了代表

UINavigationControllerDelegate,UIImagePickerControllerDelegate

拍摄了图像,我可以看到移动和缩放框,但是当我移动它时,框会返回到初始位置 - 就像它弹回一样。

这是为什么?

4

1 回答 1

1

看起来这是因为您正在请求UIImagePickerControllerOriginalImage,根据文档,这将返回“用户选择的原始、未裁剪的图像”。

尝试将其更改为UIImagePickerControllerEditedImage.

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

编辑:实际上,如果问题发生在选择器本身,则在重新阅读问题几次后,这可能无济于事。

于 2013-11-02T08:15:33.777 回答