Passing touch events to appropriate sibling UIViews

后端 未结 2 1012
时光取名叫无心
时光取名叫无心 2021-02-13 20:53

I\'m trying to handle touch events with touchesBegan in an overlay to a parent UIView but also allow the touch input to pass through to sibling U

2条回答
  •  清歌不尽
    2021-02-13 21:39

    Late answer, but I think you would be better off overriding hitTest:withEvent: instead of touchesBegan. It seems to me that touchesBegan is a pretty "high-level" method that is there to just do a simple thing, so you cannot alter at that level if the event if propagated further. The right place to do that is hitTest:withEvent:.

    Also have a look at this S.O. answer for more details about this point.

提交回复
热议问题