这就是我所做的:
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (!decelerate) {
[self scrollingFinish];
}
}
..
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
[self scrollingFinish];
}
..
- (void)scrollingFinish {
NSIndexPath *firstVisibleIndexPath = [[self.tableView indexPathsForVisibleRows] objectAtIndex:0];
NSLog(@"first visible cell's section: %i, row: %i", (int) firstVisibleIndexPath.section, (int) firstVisibleIndexPath.row);
APFCategoryCell * cell = (APFCategoryCell*) [self.tableView cellForRowAtIndexPath:firstVisibleIndexPath];
[cell animateCell];
[self.tableView scrollToRowAtIndexPath:firstVisibleIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
出现的问题,如果用户上下滚动,因为动画细胞仍然可见,下一个被动画。所以两个或更多的单元格是动画的。我可以继续在我的自定义单元格中实现一个方法,例如- (void) resetAnimatedCell
,但也许有更好的方法来做到这一点?
到目前为止你有尝试过吗? – Pancho