How to steal touches from UIScrollView?

前端 未结 3 1243
情歌与酒
情歌与酒 2020-12-01 02:01

Today on my creative time I did some quite comprehensive research on how to steal touches from a UIScrollView and send them instantly to a specific subview, while maintainin

3条回答
  •  半阙折子戏
    2020-12-01 02:38

    I'm also late to the party, but for newcomers, if you're just looking to flat out ignore swipes on the scroll view, what worked for me was to add a pan gesture recognizer to the view I want ignoring the swipes, like this:

    let panGesture = UIPanGestureRecognizer()
    panGesture.cancelsTouchesInView = false
    myView?.addGestureRecognizer(panGesture)
    

提交回复
热议问题