【发布时间】:2019-01-12 00:43:38
【问题描述】:
在父 ViewController 中使用以下代码,我想在第一个视图之上显示第二个视图,然后关闭第一个视图:
// Animates the next questionViewController using the first questionViewController
[previousView presentViewController:nextQuestionViewController animated:YES completion:nil];
// Dismiss the first questionViewController
[previousView dismissViewControllerAnimated:NO completion:nil];
运行时,会显示第二个视图,但不会关闭第一个视图。
【问题讨论】:
-
previousView 是导航控制器堆栈上的 viewController 还是模态显示?
-
是的,它是模态显示的。我不知道为什么它不会关闭。
-
从你的代码中,它只说 presentViewController:animated,而不是 presentModalViewController:animated
-
从你的代码中,它只说 presentViewController:animated:completion:,而不是 presentModalViewController:animated:。检查消息中间的模态词。除非,presentViewController 是自定义方法,否则我们需要更多代码。
-
从你的代码中,它只说 presentViewController:animated:completion:,而不是 presentModalViewController:animated:。检查消息中间的模态词。除非,presentViewController 是自定义方法,否则我们需要更多代码。
标签: iphone viewcontroller