1.需要添加手势的界面
(1)addBackGesture()
(2) 设置手势返回代理 // MARK: - 添加返回手势 extension JYRTSShopDetialConteoller:UIGestureRecognizerDelegate{ func addBackGesture(){ self.navigationController?.interactivePopGestureRecognizer?.delegate = self self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true } }
2. 前提是 本界面导航控制器是隐藏的 (1) 在home控制器设置 代理 self.navigationController?.delegate = self (2)在代理方法隐藏 导航控制器 func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { if viewController is JYRTSShopDetialConteoller{ self.navigationController?.setNavigationBarHidden(true, animated: true) } }
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 22.0px Menlo; color: #ffffff; background-color: #000000 }
原文地址:https://www.cnblogs.com/qingzZ/p/9916326.html
时间: 2024-10-30 05:42:21