Ios 在完成SavingWitherRor后,如何解除图像选择器?

Ios 在完成SavingWitherRor后,如何解除图像选择器?,ios,uiimagepickercontroller,Ios,Uiimagepickercontroller,我想做的就是在警告显示图片已保存或未保存后,应取消选取程序,但我无法找到如何进行 我以如下方式呈现图像控件: [self presentModalViewController:imagePicker animated:YES]; 我知道我需要解除ModalViewController,因为我是为cancel案例而这样做的,但我不知道该将其放置在何处,以便在图像保存后它仍然存在 - (void) imagePickerController:(UIImagePickerController *)p

我想做的就是在警告显示图片已保存或未保存后,应取消选取程序,但我无法找到如何进行

我以如下方式呈现图像控件:

[self presentModalViewController:imagePicker animated:YES];
我知道我需要解除ModalViewController,因为我是为cancel案例而这样做的,但我不知道该将其放置在何处,以便在图像保存后它仍然存在

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
        UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

        UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
    }

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    UIAlertView *alert;

    // Unable to save the image  
    if (error)
        alert = [[UIAlertView alloc] initWithTitle:@"Error" 
                                           message:@"Unable to save image to Photo Album." 
                                          delegate:self cancelButtonTitle:@"Ok" 
                                 otherButtonTitles:nil];
    else // All is well
        alert = [[UIAlertView alloc] initWithTitle:@"Success" 
                                           message:@"Image saved to Photo Album." 
                                          delegate:self cancelButtonTitle:@"Ok" 
                                 otherButtonTitles:nil];
    [alert show];
}

这取决于您如何呈现imagepickercontroller如果您使用了PeserntModelViewController初始化:然后使用DismissModalViewController初始化:

您必须在本地创建UIImagePickerController的实例,并且在alertview委托方法中,只需将其关闭。

我更新了问题。一般来说,我知道如何取消它,因为我是因为取消而取消它,但我不知道在显示警报后如何取消它。您能更具体一些吗?如何在本地创建实例?创建UIImagePickerController*imagepicker;在controller.h和alertview delegte[self dismissModalViewControllerAnimated:TRUE]中;到这里来