How do I, from a cell, get its indexPath
in a UITableView
?
I've searched around stack overflow and google, but all the information is on the other way around. Is there some way to access the superView
/UITableView
and then search for the cell?
More information about the context: there are two classes that I have, one is called Cue
and one is called CueTableCell
(which is a subclass of UITableViewCell
) CueTableCell
is the visual representation of Cue
(both classes have pointers to each other). Cue
objects are in a linked list and when the user performs a certain command, the visual representation (the CueTableCell
) of the next Cue
needs to be selected. So the Cue
class calls the select
method on the next Cue
in the list, which retrieves the UITableView
from the cell
and calls its selectRowAtIndexPath:animated:scrollPosition:
, for which it needs the indexPath
of the UITableViewCell
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…