views:

429

answers:

1

My app has a set of categories. A category can have sub-categories.

DirectoryCategoryController is the first screen, displaying all the top-level categories. Works great. When you tap a cell, if the category selected has sub-categories, I instantiate a new instance of DirectoryCategoryController and push it to display the sub-categories. From there, you tap a sub-category and see the contents.

The problem is that while the top level works fine, when I tap in and see the sub-categories, the table view won't scroll. The search bar takes touches, the table cells take touches but up and down scrolling does not work, like the table view is vertically frozen in space.

If I tap the search bar and hit cancel or if I go into a sub-categories contents and then hit back, the very same table view that didn't scroll works just fine.

Also, if the table view has more items than fit on the screen (about anything bigger than 8 in this layout), everything works.

Very odd problem ; kinda blowing my mind. Any insight?

+1  A: 

So, I figured this out and thought I would answer as a reference.

At this point, I think it may be an iPhone OS bug and I'm filing a RADAR.

A UIScrollView, of which UITableView is a subclass, will not attempt to scroll if everything fits on one screen.

In my case, it appears the scroll view thought everything fit (it was very close) but it didn't. Actually, if you removed the UISearchBar from the UITableView, everything would have fit and it wouldn't need to scroll. My guess is that it's incorrectly determining the geometry when the UISearchBar is attached.

Anyway, the work-around was to add this: [self.tableView setAlwaysBounceVertical:YES];

The odd thing was that when another view was pushed and then popped, the vertical bounce worked fine, furthering my suspicions it's an iPhone bug.

Hunter