相机中的ios7 CameraPickerController图像被冻结 [英] ios7 CameraPickerController image from camera is frozen
问题描述
我有相机View控制器的简单代码:
I have this simple code for camera View controller:
UIImagePickerController picker = new UIImagePickerController();
picker.PrefersStatusBarHidden ();
picker.SourceType = UIImagePickerControllerSourceType.Camera;
UIImagePickerControllerCameraDevice dev = picker.CameraDevice;
PresentViewController (picker, false, null);
picker.FinishedPickingMedia += (object sender, UIImagePickerMediaPickedEventArgs e) => BeginInvokeOnMainThread (delegate {DismissViewController (false, null);});
当应用程序启动时,我可以正常拍摄照片,但是当我再次出现选择器时,会出现相机视图但是显示并冻结上一次拍摄的帧(图像)。如果我移动我的设备图像不会改变。换句话说,我可以使用相机一次,但我不能使用它两次。我做错了什么?在 iOS6
设备上它完美运行。
When app starts, I can capture photo normally, but when i present picker again, camera View appears but frame(image) from previous shot is shown and frozen. If i move my device around image doesn't change. In other words, I can use camera once but I can not use it twice. What I am doing wrong? On iOS6
devices it works perfectly.
推荐答案
制作一个pickerDelegate类我的诀窍。你只需要在构造函数中传递当前的VC,这样就可以处理VC中的图像了。
Making a pickerDelegate class did the trick for me. You just have to pass the current VC in the constructor so you can handle the image in your VC.
PickerDelegate
private class pickerDelegate : UIImagePickerControllerDelegate
{
private yourVC _vc;
public pickerDelegate (yourVC controller) : base ()
{
_vc = controller;
}
public override void FinishedPickingImage (UIImagePickerController picker, UIImage image, NSDictionary editingInfo)
{
//Do something whit the image
_vc.someButton.SetBackgroundImage (image, UIControlState.Normal);
//Dismiss the pickerVC
picker.DismissViewController (true, null);
}
}
ViewDidLoad
imagePicker = new UIImagePickerController ();
//Set the Delegate and pass the current VC
imagePicker.Delegate = new pickerDelegate (this);
这篇关于相机中的ios7 CameraPickerController图像被冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!