美文网首页
解决右滑返回手势和UIScrollView中的手势冲突,5行代码

解决右滑返回手势和UIScrollView中的手势冲突,5行代码

作者: 梁同桌 | 来源:发表于2016-12-14 16:16 被阅读66次
    class BaseScrollView: UIScrollView {
        override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
            //意思是,触摸X点小于10, 我scrollView不要这个手势,
            if point.x < 10 {
                return nil
            }//让它把这个手势给别人。
            return super.hitTest(point, with: event)
        }
    }
    

    相关文章

      网友评论

          本文标题:解决右滑返回手势和UIScrollView中的手势冲突,5行代码

          本文链接:https://www.haomeiwen.com/subject/jugimttx.html