我有一个UIViewController
(称为控制器A),该控制器通过淡入动画在当前控制器(称为B)上打开。控制器A中只有一个UITextVİew
和两个UIButton
(“关闭并继续”)。我可以成功地通过动画呈现和关闭它。但是,当我在完成关闭功能时调用委托方法时,textView会保留在屏幕上,直到整个动画完成,然后直接消失。是什么原因造成的?以及如何解决?
关闭代码:
let transition = CATransition().fadeTransition()
transition.isRemovedOnCompletion = true
self.view.window!.layer.add(transition, forKey: nil)
self.dismiss(animated: false, completion: {
self.kvkkControllerProtocol?.backFromCamera() //If I comment this everything works great.
})
我如何声明协议:
weak var aggrementDelegate: PushToCameraController?
代理功能:
func pushToCameraController() {
let controller = BarcodeReaderViewController()
controller.comesFromKvkk = false
self.navigationController?.pushViewController(controller, animated: true)
}
我如何展示控制器A:
let kvkkController = AggrementViewController()
kvkkController.aggrementDelegate = self
kvkkController.kvkkControllerProtocol = self
kvkkController.view.backgroundColor = .clear
kvkkController.modalPresentationStyle = .overCurrentContext
kvkkController.modalTransitionStyle = .crossDissolve
kvkkController.callbackClosure = { [weak self] in
self?.removeBlur()
}
编辑:我发现,如果我在pushToCameraController()函数中注释代码,则一切正常。另外,控制器B在UINavigationController