0

我试着打电话

[tableView scrollToItemAtIndex: [tableView indexForCell: firstVisibleCell] atScrollPosition: UITableViewScrollPositionTop animated:YES];

强制我的表“捕捉”到第一个可见项目。这工作正常,但我只接到电话

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView

何时必须完成滚动(在文档中说明)。无论如何我可以获得firstVisibleCell的偏移量,以便我可以进行比较以查看是否需要滚动?

4

1 回答 1

1

使用方法- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath

NSIndexPath *indexPath = [tableView indexForCell:firstVisibleCell];
CGRect rect = [tableView rectForRowAtIndexPath:indexPath];
于 2010-06-20T13:42:38.037 回答