gpt4 book ai didi

ios - imagePickerController 移动和缩放不起作用

转载 作者:技术小花猫 更新时间:2023-10-29 11:08:10 25 4
gpt4 key购买 nike

这是我的代码:

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


}

我已经实现了委托(delegate)

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

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

关于ios - imagePickerController 移动和缩放不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19328452/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com