0

I have a UIView with buttons, floating on top of a UITableView. I need the user to be able to tap on the buttons inside the UIView, or scroll the UITableView below when they attempt to scroll over the UIView.

I've tried using isUserInteractionEnabled = false and overriding hitTest / point. However, they all cause touch events to pass through the UIView completely. Instead, I want the touch event to occur for both the UIView and the UITableView to achieve the intended effect. Is such a mechanism possible?

  • I'm assuming the UIView is a sibling of the UITableView? So when users move their fingers on the UIView, the table view will be scrolled? – Sweeper Feb 11 '20 at 18:32
  • 1
    Setting `isUserInteractionEnabled = false` in the UIView works for me. Can you show a [mcve]? – Sweeper Feb 11 '20 at 18:39

1 Answers1

0

You could use separate gesture recognizers for the table view and uiview, then take different actions based on which of them was touched. Gesture recognizers can be configured for multiple of different types of touches (taps, pans, etc) so they're easy to customize and use, and will properly capture which item has been interacted with.