我有UIViewController
从使用自定义左/后退按钮的navigationController
推送到interactivePopGestureRecognizer,但是,当我从tableview中点击一行时,我的应用程序有时会卡住并按下主页按钮后继续然后重新打开应用程序的背景,它继续但导航控制器的滑动动作变得奇怪。这是我所说的视频;
//This is the function that I use to open chat from tableview on didSelectRowAt
func openChat(with nick: String, isFromConversationList: Bool) {
guard let chatVC = UIStoryboard(name: "Main", bundle: .main).instantiateViewController(withIdentifier: "ChatViewController") as? ChatViewController,
let rootNC = UIApplication.shared.keyWindow?.rootViewController as? UINavigationController else {
return
}
rootNC.pushViewController(chatVC, animated: true)
}
override func viewDidLoad() {
super.viewDidLoad()
navigationController?.interactivePopGestureRecognizer?.delegate = nil
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
}
可能是什么原因?