在调用完成块之前,CATransaction会在viewDidDisappear之后等待吗?
CATransaction.begin()
view_controller.navigationController?.popViewController(animated: false)
CATransaction.setCompletionBlock {
self.call_some_function()
}
CATransaction.commit()
如果view_controller有一个自定义viewDidDisappear函数,那么在viewDidDisappear函数完成执行后会执行self.call_some_function()吗?
我试图设置断点,事实证明viewDidDisappear确实在完成块之前执行。不确定这种行为是否总是可预测的,因为我无法找到任何文档。
答案 0 :(得分:0)
尝试在弹出视图控制器
之前设置完成块CATransaction.begin()
CATransaction.setCompletionBlock {
self.call_some_function()
}
view_controller.navigationController?.popViewController(animated: false)
CATransaction.commit()
或
CATransaction.setCompletionBlock {
self.call_some_function()
}
CATransaction.begin()
view_controller.navigationController?.popViewController(animated: false)
CATransaction.commit()