0

当我使用pushViewController导航按钮时,我会进入一个空白视图Saved photos,我不知道为什么。我想ReportViewController在选择图像后移动到。

这是我的代码,看起来还可以。可能出了什么问题?

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

//Geting the image from the camera
image = [info objectForKey:UIImagePickerControllerOriginalImage];

ReportViewController *imageSelectionVC = [[ReportViewController alloc] init];
[imageSelectionVC.imageReport setImage:image];

    [picker pushViewController:imageSelectionVC animated:YES];
}
4

1 回答 1

0

正如评论所说,您必须关闭选择器并将新控制器推送到您的动画控制器(假设您有一个)

这是正确的代码:

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

    [picker dismissViewControllerAnimated:YES completion:^{
        ReportViewController *imageSelectionVC = [[ReportViewController alloc] init];
        [imageSelectionVC.imageReport setImage:image];

        [self.navigationController pushViewController:imageSelectionVC animated:YES];
    }];
}
于 2013-10-08T09:36:37.440 回答