comment savoir indexpath de UITableView.visibleCells?
NSArray * arrayOfVisibleTVC=[BNUtilitiesQuick ListController].tableViewA.visibleCells;
NSLog(@"array : %@", arrayOfVisibleTVC);
affiche
"<UITableViewCell: 0x76c22a0; frame = (0 0; 320 75); autoresize = W; layer = <CALayer: 0x76bf770>>",
"<UITableViewCell: 0x76cfec0; frame = (0 75; 320 75); autoresize = W; layer = <CALayer: 0x769d260>>",
"<UITableViewCell: 0xe245f70; frame = (0 150; 320 75); autoresize = W; layer = <CALayer: 0xe245ed0>>",
"<UITableViewCell: 0xe248980; frame = (0 225; 320 75); autoresize = W; layer = <CALayer: 0xe2488c0>>",
"<UITableViewCell: 0xe24afa0; frame = (0 300; 320 75); autoresize = W; layer = <CALayer: 0xe24aee0>>"
et avec cette
UITableViewCell * lastObjectOfArray=arrayOfVisibleTVC.lastObject;
int indexpathLastObject= (lastObjectOfArray.frame.origin.y/new.frame.size.height);
Je sais que le dernier de arrayOfVisibleTVC.lastObject que j'utilise pour obtenir indexpath. mais je pense qu'il y a un autre moyen d'obtenir indexpath de TableViewcell qui a montré.. quelqu'un peut m'aider?
afin que je puisse obtenir indexpath de la cellule, en tant qu'entier
- Avez-vous essayé le indexPathForCell: méthode?
Vous devez vous connecter pour publier un commentaire.
Ici, c'est la méthode dans UITableView classe:
objective-c
Swift
UITableView a une méthode pour trouver les indexPath d'une cellule:
Viens de parcourir votre visible cellules de tableau et passer chaque cellule pour obtenir le chemin d'index.