我有一个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
}
Run Code Online (Sandbox Code Playgroud)
可能是什么原因?
| 归档时间: |
|
| 查看次数: |
318 次 |
| 最近记录: |