iphone - UIImagePickerController 卡在解雇上

标签 iphone xcode

这是我的代码:

-(IBAction)addUserChooseImage:(id)sender{    
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:picker animated:YES];
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:     (UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
    uploadedImage.image = image;
    [picker dismissModalViewControllerAnimated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [picker dismissModalViewControllerAnimated:YES];
}

尝试关闭选择器时它会粘住。我相信原因是图像选择器是由位于 View Controller 本身加载的 Nib View 上的按钮激活的。

谁能告诉我消除它的正确方法是什么?我想委托(delegate)应该仍然引用 self,对吗?

谢谢

最佳答案

您无法使用 [picker DismissModalViewControllerAnimated:YES]; 方法关闭选取器。

[pickermissModalViewControllerAnimated:YES];替换为[selfdismissModalViewControllerAnimated:YES];

关于iphone - UIImagePickerController 卡在解雇上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13375106/

相关文章:

ios - NSNotificationCenter。将数据从一个发送到另一个 ViewControllers Swift

iphone - CGAffineTransformMakeRotation错误

Xcode 5 不会导入配置文件

ios - 禁用/启用 UIDatepicker

iphone - SentTestCase 不会将 UnitTest 失败突出显示为代码中的错误

cocoa - Xcode/ cocoa : What are the differences between debug and release builds?

iphone - Objective-C 数据结构(构建我自己的 DAWG)

iphone - 修改 xcode 字符串文件 post Archive : Converting Binary to UTF-8

iphone - 如何隐藏 iOS 数字键盘

ios - 无法对 flurry 崩溃日志进行去符号化