0

I have successfully created and linked the cell using the XIB,but the query is how do I assign different identifier (reuseIdentifier) to different cells of a UITableView? Suppose I have a tableView of SignUp Form ... So I would like to have the first cell having Identifier 'nameCell' next 'passwordCell' and so on.

I can Achieve this if without using XIB by Identifying the purpose of the cell with its index, but just wondered if this can be done.

Regards, Dhanesh.

infiniteLoop
  • 2,135
  • 1
  • 25
  • 29

1 Answers1

1

It is very much possible, and in fact, necessary if you have different cell types in the same table. Here is an example taken from one of my projects:

NSString *CellIdentifier = @"Cell";

if ((indexPath.section > 0) && (indexPath.row == [tableView numberOfRowsInSection:indexPath.section] - 1)) {
    CellIdentifier = @"GreenCell";
}
else {
    CellIdentifier = @"StandardCell";
}
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
sosborn
  • 14,676
  • 2
  • 42
  • 46