在解雇另一个之后立即呈现模态视图控制器 [英] Presenting a modal view controller immediately after dismissing another

查看:72
本文介绍了在解雇另一个之后立即呈现模态视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在解雇一个模态视图控制器然后立即呈现另一个,但后者永远不会发生。这是代码:

I'm dismissing a modal view controller and then immediately presenting another one, but the latter never happens. Here's the code:


 [self dismissModalViewControllerAnimated:YES];

 UIImagePickerController *picker = [[UIImagePickerController alloc] init];
 picker.delegate = self;
 picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
 [self presentModalViewController:picker animated:YES];

第一个模态VC向下滑动,但新的选择器永远不会出现。想知道发生了什么事吗?

The first modal VC slides down, but the new picker never comes up. Any idea as to what's going on?

推荐答案

像其他动画一样, dismissModalViewControllerAnimated 在视图控制器消失之前不会阻塞。相反,它开始解雇视图控制器。您可能需要在模式控制器1的 viewDidDisappear 中使用回调,该回调在父视图控制器中调用类似 modalViewControllerDisappeared 的内容。在那个方法中你提出模态控制器2.否则机器人K说什么。

Like other animated things, dismissModalViewControllerAnimated doesn't block until the view controller disappears. Instead it "kicks off" dismissal of the view controller. You might need to use a callback in viewDidDisappear of modal controller 1 that calls something like modalViewControllerDisappeared in the parent view controller. In that method you present modal controller 2. Otherwise what Robot K said.

这篇关于在解雇另一个之后立即呈现模态视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆