//tabview出列cell的代理方法,加載定制的三個(gè)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是個(gè)數(shù)組,按照左邊的順序進(jìn)行排序路狮。三個(gè)cell關(guān)聯(lián)的都是一個(gè)類