Strange Case of the non-scrolling-to-top UITableView

Earlier today I had a situation in which the gesture to scroll a UITableView to the top by tapping on the iPhone status bar was not working.

Strange and annoying.

On doing some investigation, I found a clue on StackOverflow which pointed me in the right direction. It turns out that if you have a nested scroll view whose scrollToTop property is set to YES (the default), it will prevent the containing UIScrollView (or in this case a descendent thereof, UITableView) from recognizing and responding to that gesture.

In fact, in the documentation for UIScrollView, it says the following under “Special Considerations”:

Special Considerations
On iPhone, the scroll-to-top gesture has no effect if there is more than one scroll view on-screen that has scrollsToTop set to YES.

In my case I have a UIScrollView inside each UITableViewCell, which was defaulting to YES for scrollsToTop. Once I programmatically set that property to NO, the UITableView began responding to that gesture again!

Case Closed!