//tabview出列cell的代理方法,加載定制的三個xib出列三種cell。xib是數(shù)組
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
CUYearCardCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"];
if (!cell) {
if (indexPath.row == 0) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"CUYearCardCell" owner:nil options:nil] firstObject];
} else if (indexPath.row == 1) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"CUYearCardCell" owner:nil options:nil] objectAtIndex:1];
} else {
cell = [[[NSBundle mainBundle] loadNibNamed:@"CUYearCardCell" owner:nil options:nil] lastObject];
}
}
return cell;
}
//cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0) {
return 60;
} else if (indexPath.row == 1) {
return 60;
} else {
return 40;
}
}
xib是個數(shù)組,按照左邊的順序進行排序。三個cell關(guān)聯(lián)的都是一個類

B712F39E-3158-4384-831A-9EAD70F3640B.png