UIImagePickerController允许编辑不起作用 [英] UIImagePickerController AllowsEditing not working
问题描述
我正在使用UIImagePickerController来允许用户拍照。我想让他之后编辑它,但无论我做什么,我什么也得不到。这是我的代码(我正在使用Xamarin):
I am using UIImagePickerController to allow the user to take a picture. I want to allow him to edit it afterwards but whatever I am doing i get nothing. Here is my code (I am using Xamarin):
UIImagePickerController imagePicker = new UIImagePickerController ();
// set our source to the camera
imagePicker.SourceType = UIImagePickerControllerSourceType.Camera;
// set what media types
//imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.Camera);
// show the camera controls
imagePicker.ModalPresentationStyle = UIModalPresentationStyle.CurrentContext;
imagePicker.ShowsCameraControls = true;
imagePicker.AllowsEditing = true;
imagePicker.SetEditing (true,true);
imagePicker.PreferredContentSize = new SizeF(900,600);
imagePicker.CameraCaptureMode = UIImagePickerControllerCameraCaptureMode.Photo;
imagePicker.Title="taste.eat. image";
// attach the delegate
imagePicker.Delegate = new ImagePickerDelegate();
// show the picker
NavigationController.PresentViewController(imagePicker, true,null);
我错过了什么吗?
编辑:
我已经按照教程进入屏幕,但是如果我平移或缩放它只是快速恢复到一旦我举起手指,我的中心。是否可以从照片应用程序进入此屏幕?
I have followed the tutorial and I am getting to the screen with the rectangle, but if i pan or zoom it just snaps back to the center once I lift my finger. Is it possible to get to this screen from the photos application?
推荐答案
当使用UIImagePickerController的委托-imagePickerController:didFinishPickingMediaWithInfo:时,我们使用<获取图像/ p>
When using UIImagePickerController's delegate -imagePickerController:didFinishPickingMediaWithInfo: ,we get the image using
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
即使编辑为ON,此代码也将始终返回原始图像。
This code will always return the original image, even if editing is ON.
尝试使用
UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
如果编辑为ON,这将返回编辑过的图像。
This will return the edited image if editing is ON.
希望这会有所帮助。
这篇关于UIImagePickerController允许编辑不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!