首页 > 编程语言 > 详细

swift - VC添加手势返回

时间:2018-11-06 17:12:53      阅读:175      评论:0      收藏:0      [点我收藏+]
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)
        }
    }

  

swift - VC添加手势返回

原文:https://www.cnblogs.com/qingzZ/p/9916326.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!