ios - 关闭从模态呈现的 View Controller 翻转的 View Controller

标签 ios swift uiviewcontroller uinavigationcontroller

我从 UIViewController A 模态地呈现 UIViewController B。然后,B 和 C 之间有一个 UINavigationController,并且 C 从 B 翻转。我想忽略 B 和 C 并直接向 A 进行动画处理,而不显示 B 和因此无需调用 B 的 viewDidLoad 函数。我从A调用di​​smissViewControllerAnimated,但这仍然首先显示B,因此调用B的viewDidLoad函数。如果对此已经有一个答案,请原谅我;我已经窥探了几个小时但找不到答案。我该如何解决这个问题?

最佳答案

任何以模态方式呈现的父ViewController都可以使用以下方法关闭:

[self.parentViewController dismissModalViewControllerAnimated:YES];

另一种方法是使用:

[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];

如果不起作用,请告诉我。

关于ios - 关闭从模态呈现的 View Controller 翻转的 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38533788/

相关文章:

swift - mailcore2如何在swift中实现它

objective-c - 核心音频 : the proper method of reading an AudioFileMarkerList?

ios - 如何检测是否从导航 Controller 弹出 View Controller ?

ios - Swift 中可拖动背景框作为 slider

ios - 圆形 Collection View 布局

ios - swift 2 将 int 转换为 numberFromString 作为 String

ios - UITextView 和 UILabel subview 属性为零

objective-c - 如何使用 MasterDetail 应用程序模板更新 DetailView

swift - 绘制带有约束的形状 swift 4

ios - 跨多个 View Controller 使用共享背景 View 的最佳实践是什么?