-1

基本上我有一个表格视图,我可以通过以下方式滚动:

 [self.tableView scrollToRowAtIndexPath:indexPath
                          atScrollPosition:UITableViewScrollPositionTop
                                  animated:YES];

但是当我这样做时,它滚动得非常快,我希望它滚动得慢一点。如何实现?

4

2 回答 2

2

您也可以使用 UIView 动画,但为方法的动画选项传递 NO,如下所示。通过更改动画持续时间,您可以使其变慢或变快

[UIView animateWithDuration:0.5 animations:^(void){
        [self.tableView scrollToRowAtIndexPath:indexPath
                          atScrollPosition:UITableViewScrollPositionTop
                                  animated:NO];
    }]
于 2013-05-07T10:07:22.090 回答
1

这是另一种解决方案,尝试这样。

[UIView animateWithDuration:5.0 animations:^{
        //Move table view to where you want
         [tableView setContentOffset:CGPointMake(0, 500)];
    } completion:^(BOOL finished){
    }];
于 2013-05-07T10:15:08.070 回答