How to pass a 'tap' to UIButton that is underneath UIView with UISwipeGestureRecognizer?

后端 未结 4 1845
伪装坚强ぢ
伪装坚强ぢ 2021-02-07 13:09

I have a UIButton underneath a (transparent) UIView. The UIView above has a UISwipeGestureRecognizer added to it, and that is its only purpose - to detect certain swipe gestures

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-07 13:31

    I must have just been in a funk yesterday - I woke up with a simple solution today. Add the UISwipeGesture to a view which is a superview to both the UIView and the UIButton. Then, when processing those swipes, figure out where the swipe originated, and whether that point is in the frame of where I used to have the UIView. (As I mentioned, the only reason for the existence of the UIView was to define a target area for these swipe gestures.)

提交回复
热议问题