0

I'm trying to call

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

To force my table to 'snap' to the first visible item. This works fine, but I only get a call to

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView

When scrolling had to be completed (which is stated in the document). Is there anyway that I can get the offset of the firstVisibleCell so I can do a comparison to see if scrolling is required?

Kyle
  • 17,317
  • 32
  • 140
  • 246

1 Answers1

1

Use the method - (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath:

NSIndexPath *indexPath = [tableView indexForCell:firstVisibleCell];
CGRect rect = [tableView rectForRowAtIndexPath:indexPath];
Ed Marty
  • 39,590
  • 19
  • 103
  • 156