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]
returns nil
for 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With