This is just a test, which i might add it to the app. Well.... I have a tableView
.
If click button1
, I want the tableView to scr
You can also look at the scroll view's setContentOffset:animated:
method.
Going to the top would mean,
[self.tableView setContentOffset:CGPointZero animated:YES];
and the bottom would be,
CGFloat height = self.tableView.contentSize.height - self.tableView.bounds.size.height;
[self.tableView setContentOffset:CGPointMake(0, height) animated:YES];
You won't have control over the animation duration.
The only problem with scrollToRowAtIndexPath:atScrollPosition:animated:
is that it might not be helpful when section and table headers are set.
scrollToRowAtIndexPath:atScrollPosition:animated:
Scrolls the receiver until a row identified by index path is at a particular location on the screen.
- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated