iOS SDK: How to get a cell in a table view that is not visible?

advertisements

How do I get the cell for an indexPath which is not currently visible in the table? (cell is out of range)

Code for getting my cell:

NSString *name = [[(ELCTextfieldCell *)[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] rightTextField] text];

-cellForRowAtIndexPath... returns nil because the cell at the required indexPath is out of range. So how do I get the correct cell and not nil?


This is not how it works. You need to grab and store the information as soon as it is entered or changed. It may easily get out of scope and you cannot guarantee your cell lives long enough. Well, technically you can hold onto it (and always return the very same cell for the same index path), but I'd question that design.