Mehrere benutzerdefinierte Zeilen UITableView?
Ich habe viel gesucht, aber nichts Nützliches im Zusammenhang mit mehreren benutzerdefinierten Zeilen gefunden. Ich muss eine tableView-Einstellung für meine App erstellen, in der ich die Zeilen aus XIB-Dateien laden muss, z.
REIHE 1 = >> XIB 1.
REIHE 2 = >> XIB 2.
REIHE 3 = >> XIB 3.
REIHE 4 = >> XIB 4.
Mein aktueller Code:
<code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell=nil; //We use CellType1 xib for certain rows if(indexPath.row==0){ static NSString *CellIdentifier = @"ACell"; cell =(ACell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell==nil){ NSArray *nib= [[NSBundle mainBundle] loadNibNamed:@"ACell" owner:self options:nil]; cell = (ACell *)[nib objectAtIndex:0]; } //Custom cell with whatever //[cell.customLabelA setText:@"myText"] } //We use CellType2 xib for other rows else{ static NSString *CellIdentifier = @"BCell"; cell =(BCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell==nil){ NSArray *nib= [[NSBundle mainBundle] loadNibNamed:@"BCell" owner:self options:nil]; cell = (BCell *)[nib objectAtIndex:0]; } //Custom cell with whatever //[cell.customLabelB setText:@"myText"] } return cell; } </code>