关闭ImagePickerController并无缝转换到新的ViewController

时间:2015-07-13 05:46:05

标签: ios objective-c uiimagepickercontroller

我有一个viewController VC1,我在其中使用 sourcetype 相机展示UIImagePickerController ..然后在拍照后,过渡到新的viewController使用图像。问题是,如何解除imagePicker并无缝转换到我的新viewController。例如在我的

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

方法,我尝试使用这两种方法中的任何一种来解除选择器并无缝地呈现新的viewController

[self.presentedViewController presentViewController:postControl animated:NO completion:^{
        [picker dismissViewControllerAnimated:NO completion:nil];
    }];

/*
[picker dismissViewControllerAnimated:NO completion:^{
        [self presentViewController:postControl animated:NO completion:nil];
    }];
*/

显然第一个是错误的,因为我要求呈现视图控制器在动画期间解除自身,导致错误。如果我将picker更改为self.presentingViewController,它永远不会关闭相机,第二位代码(评论的那个)可以正常工作,但不是无缝的,换句话说,您可以看到过渡。

很抱歉没有理解这个问题,但我只是没有看到它。如何在无缝地呈现postControl之前或之前关闭相机? 在,你看不到过渡?

1 个答案:

答案 0 :(得分:1)

UIViewController* toPresentViewController = [[UIViewController alloc] init];

[picker dismissViewControllerAnimated:YES completion:^
{
    [self.presentingViewController presentViewController:toPresentViewController animated:YES completion:nil]
}];
相关问题