滑动操作时UINavigationController崩溃UI(黑屏,视频里面)

时间:2018-02-02 11:11:34

标签: ios swift

我有UIViewController从使用自定义左/后退按钮的navigationController推送到interactivePopGestureRecognizer,但是,当我从tableview中点击一行时,我的应用程序有时会卡住并按下主页按钮后继续然后重新打开应用程序的背景,它继续但导航控制器的滑动动作变得奇怪。这是我所说的视频;

https://streamable.com/xvl38

//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

}

可能是什么原因?

0 个答案:

没有答案
相关问题