No scrolling occurs when UITableView scrollToRowAtIndexPath is invoked
Posted
by theactiveactor
on Stack Overflow
See other posts from Stack Overflow
or by theactiveactor
Published on 2010-05-17T04:17:31Z
Indexed on
2010/05/17
4:20 UTC
Read the original article
Hit count: 672
cocoa-touch
|iphone
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
© Stack Overflow or respective owner