I use this function to push a new viewController:
func goToPasscodeSetupVC() {
let storyboard = UIStoryboard(name: "PassCode", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "passcodeSetupVC") as! PasscodeSetupVC
self.navigationController?.pushViewController(viewController, animated: true)
}
But, when I am on the new viewController, I want to dismiss the previous one so that I could't reach it with a swipe gesture.
您可以使用它禁用向后滑动手势。
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
You can try setViewControllers
instead of pushViewController
let storyboard = UIStoryboard(name: "PassCode", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "passcodeSetupVC") as! PasscodeSetupVC
self.navigationController?.setViewControllers([viewController], animated: true)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.