I’ve got a button that I’m adding as a subview of a table view’s tableHeaderView. The button appears fine, and tap-and-holding on it works intermittently – for the most part, though, it’s unresponsive. I’ve tried adding it as a subview of the table itself; the effect is about the same. I thought the problem might be with the scroll view’s touch interception, but disabling scrolling on the table has no effect either.
Am I doing something wrong? Has anyone else encountered this?
edit – to clarify, I’m talking about the main table header, not a section header, in a grouped-style table; think basically modeled after the “Contact” screen.
I had the same problem. In my case I had a container view instantiated in IB (that was applied as the table view header in code), with a UIImageView occupying the entire frame of that container. The misbehaving button resided in the image view.
Turns out I needed to have sizing struts in IB set as follows…
Container View: exterior anchors all on, interior resizing – all off
Sub Image View: all struts on (interior and exterior)
I had several different table views, all using header views. Some would respond to touch events correctly, some were flaky. This solved my problem