0
votes

I have two views in a viewcontroller. A tableview is embedded inside a bottom view and segue is immediately triggered to that tableview. So I'm showing a static view on top of the screen and a tableview on the bottom. The problem is that scrolling in the tableview is unresponsive. It registers taps only on the lower half. Basically there's an invisible line in the middle of the tableview and the app doesn't register anything above it (it registers only those taps which hit the first view I mentioned which is much higher than the tableview) So the user is only able to scroll if he touches only the bottom half of the tableview. Tableview functions correctly and displays valid data though

image of what's going on

Any ideas?

1

1 Answers

1
votes

Did you check the View Hierarchy Debugger (Debug->View Debugging->Capture View Hierarchy)? Typical issues to look for are:

  1. Transparent views above your tableView that gobble up touch events.To fix this, do one of the following:

    • Remove the offending transparent view
    • Fix the view hierarchy by moving the offending transparent view behind the tableView
    • Fix the layout to make sure the transparent view's bottom anchor is not below the tableView's top anchor

TableView Behind Transparent View

  1. The table view extends above its superview without being clipped. Touch events are received at the root of the view hierarchy and forwarded to the appropriate subview. In this case touch events outside the bounds of the bottom view will not be sent to the bottom view. That's why the bottom view can only forward touch events that originate within its bounds. To fix this, do one of the following:
    • Enable clipsToBounds on the container view (of course, this will just hide the part of the table that is not interactive)
    • Fix the layout to make sure the tableView is fully within the bounds of its superview

enter image description here