views:

16

answers:

0

Hi,

I try to fill my UITableView withd different UITableViewCells. I tried to choose 1 of 3 UITableViewCells out of a XIB-file by identifier but I can't get the value of the UITableViewCell's Identifier.

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



MyTableViewCell *cell = (MyTableViewCell *) [tableView dequeueReusableCellWithIdentifier:@"CellTwo"];

 if(nil == cell){

  NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"MyTableViewCell" owner:self options:nil];
  for (id currentObject in topLevelObjects) {
   if ([currentObject isKindOfClass:[MyTableViewCell class]]) {
    MyTableViewCell *tmpCell = (MyTableViewCell *) currentObject;
    if (tmpCell.identifier == @"CellTwo") {
     cell = (MyTableViewCell *) currentObject;     
    }
    [tmpCell release];
    break;
   }
  } 
 }

 cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

 return cell;}