I have a UITableViewCell
which is linked to an object and I need to tell if the cell is visible. From the research I've done, this means I need to somehow access the UITableView
that contains it (from there, there are several ways to check if it's visible). So I'm wondering if UITableViewCell
has a pointer to the UITableView
, or if there was any other way to get a pointer from the cell?
To avoid checking the iOS version, iteratively walk up the superviews from the cell's view until a UITableView is found:
id view = [tableViewCellInstance superview];
while (view && [view isKindOfClass:[UITableView class]] == NO) {
view = [view superview];
}
UITableView *tableView = (UITableView *)view;