views:

22

answers:

1

Just curious about the identifier used in

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

I saw some cases that people use different identifiers for different sections in the uiviewtable, generally speaking, what is the motivation for that?

Is it because that, for example, section 0 contains some textfileds in the cells, while section 1 just contains only pure cells without customized controls, so we need to use different identifiers for retrieving different type of cells for this scenario? How about using the same identifier?

+1  A: 

Yes, you would typically use multiple identifiers to distinguish between cells that have different purposes. Particularly if you have multiple different cell classes that might be shown, you would likely use one identifier for each cell class.

Imagine you had two cell classes MyCell1 and MyCell2 which were used to display two different types of data. If you used the same identifier for both cell types, you might get back a MyCell1 when you really need a MyCell2 for the current row.

Jason Foreman