1

I have a UIImagePickerController in my app which uses a didFinishPickingMediaWithInfo delegate to monitor whether the user has picked an image.

-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];

    if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
        UIImage *image = [info
                          objectForKey:UIImagePickerControllerOriginalImage];
    }
    [picker dismissModalViewControllerAnimated:YES];
}

When [picker dismissModalViewControllerAnimated:YES] is called, it will dismiss the current UIImagePickerController view and go back to the view before the UIImagePicker is displayed. I want to set a delegate to send back the selected image to the previous view when the dismissModalVewControllerAnimated is called. How do I do that? Many thanks!

4

1 回答 1

0

创建选取器时应设置委托。您要返回创建选择器的控制器吗?如果是这样,它应该在那时将自己设置为委托。您应该使用dismissViewControllerAnimated:completion: 而不是贬值的dismissModalViewController。

于 2013-02-13T03:04:02.153 回答