对于 2018 年...
如果你有这个...
navigationController?.popViewController(animated: false)
// I want this to happen next, help! ->
nextStep()
你想添加一个完成......
CATransaction.begin()
navigationController?.popViewController(animated: true)
CATransaction.setCompletionBlock({ [weak self] in
self?.nextStep() })
CATransaction.commit()
就这么简单。
贴心提示...
方便的popToViewController
通话也是如此。
一个典型的事情是你有一个由无数屏幕组成的入职堆栈。最终完成后,您会一直回到“基本”屏幕,然后最终启动应用程序。
所以在“基地”画面,去“一路回来”,popToViewController(self
func onboardingStackFinallyComplete() {
CATransaction.begin()
navigationController?.popToViewController(self, animated: false)
CATransaction.setCompletionBlock({ [weak self] in
guard let self = self else { return }
.. actually launch the main part of the app
})
CATransaction.commit()
}