2010-06-20 7 views
0

J'essaie d'appelerUITableView/UIScrollView scrollToItemAtIndex

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

Pour forcer ma table à 'pression' au premier élément visible. Cela fonctionne très bien, mais je reçois seulement un appel à

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView 

Lorsque le défilement devait être achevé (ce qui est indiqué dans le document). Y at-il de toute façon que je peux obtenir le décalage de firstVisibleCell afin que je puisse faire une comparaison pour voir si le défilement est requis?

Répondre

1

Utilisez la méthode - (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath:

NSIndexPath *indexPath = [tableView indexForCell:firstVisibleCell]; 
CGRect rect = [tableView rectForRowAtIndexPath:indexPath]; 
+0

Exactement ce que je cherchais. Merci! – Kyle