I’d like to be able to detect when a user taps below my UITableView’s last row, but without negatively impacting the ability to scroll the table. Is there a simpler way to do this than subclassing UITableView (i.e. overriding touchesBegan for the table)?
The reason I’d like to do this is:
When the table is empty (first time app is opened) or only has a few cells, all that space on the screen could be tapped on to invoke an Add method.
I’ve tried using a big, custom UIButton with no image (i.e. invisible) in a big tableview footer, however pressing the button impedes any scrolling, but you want scrolling once there’s already a few cells. I’m thinking I could remove the button from the footer once there’s more than zero items in the table, but that doesn’t do anything for me when there are a few items in the table already.
Thanks for any ideas!
A tap gesture recognizer set on the tableView’s footer has done the trick for me. As advertised, it detects a tap, but passes through other gestures, like scrolling, to the UITableView just fine.
The footerView is a UIView I created in my view controller’s nib file, and attached to a UIView outlet in the view controller.
I suppose a better solution would be a tap gesture recognizer set on the UITableView itself, with code to identify if the location of the tap was after the last cell. If I get around to trying that I will update.