我使用此函数来推送一个新的viewController:
func goToPasscodeSetupVC() {
let storyboard = UIStoryboard(name: "PassCode", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "passcodeSetupVC") as! PasscodeSetupVC
self.navigationController?.pushViewController(viewController, animated: true)
}
但是,当我使用新的viewController时,我想要忽略前一个,以便我无法通过轻扫手势触及它。
答案 0 :(得分:0)
您可以使用它来禁用滑动后退手势。
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
答案 1 :(得分:0)
您可以尝试使用setViewControllers
代替pushViewController
let storyboard = UIStoryboard(name: "PassCode", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "passcodeSetupVC") as! PasscodeSetupVC
self.navigationController?.setViewControllers([viewController], animated: true)