- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
switch (indexPath.section)
{
case 0:{
TwoTableViewCell *Tcell = [tableView dequeueReusableCellWithIdentifier:@"two"];
if (!Tcell) {
Tcell = [[TwoTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"two"];
}
Tcell.imageView.image = [UIImage imageNamed:@"2"];
Tcell.textLabel.text = @"创业黑马董事长:区块链是机会,但不是每个人的机会";
return Tcell;
}
break;
case 1:{
NSArray *imgarr = @[@"3",@"4",@"5"];
NSArray *textarr = @[@"区块链能否打破垄断,颠覆传统的商业模式?",@"区块链走进联合国,首届全球区块链大会",@"IDC Wallet全球首创跨链多笔山对(Swapit)服务"];
OneTableViewCell *Ocell = [tableView dequeueReusableCellWithIdentifier:@"one"];
if (!Ocell) {
Ocell = [[OneTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"one"];
}
Ocell.imgimg.image = [UIImage imageNamed:imgarr[indexPath.row]];
Ocell.lab.text = textarr[indexPath.row];
return Ocell;
}
break;
default:
{
// cell = [tableView dequeueReusableCellWithIdentifier:@""];
// if (!cell)
// {
// cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
// }
}
break;
}
return cell;
}
使用多个cell的表格注册多个
猜你喜欢
转载自blog.csdn.net/chuck_phonics/article/details/84889624
今日推荐
周排行