这是我的代码:
-(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
拍摄图像后,我可以看到“移动和缩放”框,但是当我移动它时,该框会返回到初始位置-就像它反弹回来一样。
这是为什么?
最佳答案
看起来这是由于您正在请求UIImagePickerControllerOriginalImage
引起的,根据文档,此文件将返回“用户选择的原始未裁剪图像”。
尝试将其更改为UIImagePickerControllerEditedImage
。
https://developer.apple.com/library/ios/documentation/uikit/reference/UIImagePickerControllerDelegate_Protocol/UIImagePickerControllerDelegate/UIImagePickerControllerDelegate.html#//apple_ref/doc/constant_group/Editing_Information_Keys
编辑:实际上,在重新阅读了几次问题之后,如果问题本身出现在选择器中,则可能无济于事。