UIImagePicker 冻结 [英] UIImagePicker freezes

查看:63
本文介绍了UIImagePicker 冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以调用图像选择器的模态视图控制器,选择图像并裁剪它,但是当我点击完成"时它什么也不做,它只是挂起,完成按钮变灰.没有错误,但调用了该函数.

I'm able to call the modal view controller for the image picker, pick the image, and crop it, but when I tap 'done' it doesn't do anything, it just hangs with the done button grayed out. There are no errors, but the function is called.

- (void)viewDidLoad
{
self.imgPicker = [[UIImagePickerController alloc] init];
self.imgPicker.allowsImageEditing = YES;
self.imgPicker.delegate = self;
self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {
userImage.image = img;
uploadButton.hidden = NO;
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
NSLog(@"called");
}

- (IBAction)getImage:(id)sender {
[self presentModalViewController:self.imgPicker animated:YES];
}

推荐答案

替换

 [[picker parentViewController] dismissModalViewControllerAnimated:YES];

与:

 [self dismissModalViewControllerAnimated:YES];

这篇关于UIImagePicker 冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆