I\'ve seen many many developers when implementing a UITableViewDelegate
and UITableViewDataSource
directly call cellForRowAtIndexPat
I will say rmaddy is correct, though I have one case where it is arguably practical to use:
If you ever require a copy of a UITableViewCell to apply to another view.
(derived from https://github.com/Ice3SteveFortune/i3-dragndrop)
UIView* cellCopy;
UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:indexPath];
NSData* viewCopyData = [NSKeyedArchiver archivedDataWithRootObject:cell];
cellCopy = [NSKeyedUnarchiver unarchiveObjectWithData:viewCopyData];
// Maybe to drag-and-drop outside of the UITableViewCell.
[self.otherView addSubview:cellCopy];
I want to leave this here as an example of one of the few cases where it is remotely practical to call cellForRowAtIndexPath: