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

Viewed 12052

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?

5 Answers

In continue to @Raphael's answer, Here is the (working) swift 3 solution:

UITableViewCell cell = self.tableView(self.tableView, cellForRowAt: indexPath)

Related