My view contains a simple TableView with 6 rows and a button that invokes doScroll
when clicked. My objective for doScroll()
is simply scroll to the 5th cell such that it's at top of the table view.
- (void)doScroll: (id)sender
{
NSIndexPath *index = [NSIndexPath indexPathForRow:4 inSection: 1];
[m_tableView scrollToRowAtIndexPath:index atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
However when doScroll
is invoked, the tableview scrolls only slightly. I suspect this has something to do with the size of the scroll view. So I tried increasing the height of m_tableview.contentsize
before scrolling. After I do this however, no scrolling occurs at all...
The view controller is a simple UIViewController and refers to the table view via IBOutlet. For some reason, scrolling works as expected for the default Navigation Based Application, where the controller is a UITableViewController