0
votes

I have a grouped UITableView, with cells in section 2 depending on cells in section 1. More precisely, each cell in section 1 is associated with multiple cells of section two and deleting a row in section 1 needs to delete the associated rows in section 2.

I have my dataSources all set up and everything works fine if all cells are visible. However, if the cells from section 2 haven't been loaded in the UITableView yet, I have a problem because the data source is updated for section 2 too.

I'm looking at this method visibleCells in UITableView. But I'm using custom UITableView cells and get an unrecognized selector exception if I try to access one of the labels in a cell.

How do I get around this?

Thanks,
Teja.

2
I am not fully understanding your question. Are you asking how to access a table cell that isn't currently visible?MrHen
I just want to know if it's possible to find out if a cell is currently visible.Tejaswi Yerukalapudi

2 Answers

11
votes

I believe what you were looking for is:

if ([tableView visibleCells] containsObject: theCellOfInterest]) {
    // Do whatever you want to do.
}
0
votes

Sorry if I wasn't clear the first time (or maybe even the second time too), but here's an answer to a repost of the same question.

Deleting multiple (not yet loaded) rows in UITableView