Wiele niestandardowych wierszy UITableView?
Szukałem dużo, ale nie znalazłem niczego przydatnego w wielu niestandardowych wierszach. Muszę utworzyć tabelę ustawieńWidok mojej aplikacji, w której muszę załadować wiersze z plików xib, takich jak:
WIERSZ 1 = >> XIB 1.
WIERSZ 2 = >> XIB 2.
WIERSZ 3 = >> XIB 3.
WIERSZ 4 = >> XIB 4.
Mój obecny kod:
<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>