I’m trying to get a subclassed UITableViewCell (class is called ‘MasterCell’) from my UITableViewController with an changing IndexPath. Let’s say, I’ll get the cell at the first row:
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
MasterCell *cell = (MasterCell *)[self.tableView cellForRowAtIndexPath:indexPath];
This happens in my viewWillAppear method. Unfortunately, cell is nil while debugging.
I have different cells / rows, where I have to change some values in the viewWillAppear method. Do you have any hints for me?
[self.tableView cellForRowAtIndexPath:indexPath]returnsnilfor cells which are currently not visible.You should not use the cells to store your model data, because cells are reused when you scroll up or down.