views:

35

answers:

1

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?

+1  A: 

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

NSIndexPath *indexPath = [tableView indexForCell:firstVisibleCell];
CGRect rect = [tableView rectForRowAtIndexPath:indexPath];
Ed Marty
Exactly what I was looking for. Thanks!
Zenox