- (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 dequeueReusableCellWithId
使用多个cell的表格注册多个
最新推荐文章于 2020-12-22 14:09:14 发布
本文档介绍了如何在表格中使用多个自定义Cell进行注册和管理,详细讲解了自定义Cell的创建过程以及在表格中正确显示的方法,旨在帮助开发者实现更灵活的表格展示效果。
摘要由CSDN通过智能技术生成