1

这是我的代码:

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

试图关闭选择器时它会粘住。我相信原因是图像选择器是由一个按钮激活的,该按钮位于视图控制器本身的加载 nib 视图上。

谁能告诉我什么是解雇它的正确方法?我想代表应该还是指自我,对吧?

谢谢

4

2 回答 2

1

您不能使用该[picker dismissModalViewControllerAnimated:YES];方法关闭选择器。

替换[picker dismissModalViewControllerAnimated:YES];[self dismissModalViewControllerAnimated:YES];

于 2012-11-14T08:18:33.773 回答
1

在这里你错过了一些东西见下文

你应该使用。 [self dismissModalViewControllerAnimated:YES];

而不是下面。

  [picker dismissModalViewControllerAnimated:YES]; 
于 2012-11-14T08:30:15.147 回答