当UITableView 有多个section的时候 我用经常用的if else方法总是得到fail to obtain a tableViewCell
这时候可以选择
{
switch (indexPath.section) {
case 0:
{
NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:@"HQWYSupplyListTableViewCell" owner:self options:nil];
HQWYSupplyListTableViewCell *cell = [nibs firstObject];
cell.backgroundColor = [UIColor redColor];
cell.textLabel.text = @"基本信息";
return cell;
}
break;
default:
{
NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:@"HQWEventTableViewCell" owner:self options:nil];
HQWYSupplyListTableViewCell *cell = [nibs firstObject];
cell.backgroundColor = [UIColor redColor];
cell.textLabel.text = @"公司简介";
return cell;
}
break;
}