【发布时间】:2017-06-15 18:28:39
【问题描述】:
dismissViewController 不会一直调用它正在完成的处理程序。我正在呈现第一个视图,当我关闭它时,它会调用完成处理程序,我正在呈现 2 个视图。在关闭第二个视图时,不会调用完成处理程序。这是我的代码:
if self.presentedViewController != nil {
// Checking it to make sure that I have presentedViewController and it is not dismissed already.
self.dismissViewControllerAnimated(false, completion: {
//Present 2nd controller.
})
}
【问题讨论】:
-
你把这段代码放在哪里了?
-
如果你关闭 self,vc 会在它运行完成块之前释放吗?
-
当
animation参数设置为false时,完成块不会被调用,因为代码是同步的,可以放在块外..
标签: ios swift uiviewcontroller presentviewcontroller ios9.3