In an app I\'m working on, I have a plain style UITableView that can contain a section containing zero rows. I want to be able to scroll to this section using scrollToRowAtI
UPDATE: Looks like this bug is fixed in iOS 3.0. You can use the following NSIndexPath to scroll to a section containing 0 rows:
[NSIndexPath indexPathForRow:NSNotFound inSection:section]
I'll leave my original workaround here for anyone still maintaining a project using the 2.x SDK.
Found a decent workaround:
CGRect sectionRect = [tableView rectForSection:indexOfSectionToScrollTo];
[tableView scrollRectToVisible:sectionRect animated:YES];
The code above will scroll the tableview so the desired section is visible but not necessarily at the top or bottom of the visible area. If you want to scroll so the section is at the top do this:
CGRect sectionRect = [tableView rectForSection:indexOfSectionToScrollTo];
sectionRect.size.height = tableView.frame.size.height;
[tableView scrollRectToVisible:sectionRect animated:YES];
Modify sectionRect as desired to scroll the desired section to the bottom or middle of the visible area.