dismissModalViewControllerAnimated:不消除模态视图

时间:2011-11-29 11:39:50

标签: ios uiimagepickercontroller

捕获图像后,会发生回调,但出现错误,因为它不会解除相机视图。我的代码非常直接,我唯一的疑问是我使用标签栏控制器并在其中一个标签中推送imagePicker,只是一个想法。

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



- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [self dismissModalViewControllerAnimated:YES];
    self.portaitImage.image = [info objectForKey:UIImagePickerControllerOriginalImage];
}

1 个答案:

答案 0 :(得分:2)

你需要解雇UIImagePickerController,而不是self

[picker dismissModalViewControllerAnimated:YES];