设置tableview的背景颜色和清空

设置tableview的背景颜色和清空

2023年7月13日发(作者:)

设置tableview的背景颜⾊和清空表⽰图中Cell默认是不透明的,那么在设置表⽰图的背景颜⾊和图⽚时通常是看不到的

1.给tableView设置背景view

UIImageView *backImageView=[[UIImageViewalloc]initWithFrame:];

[backImageView setImage:[UIImage imageNamed:@"liaotianbeijing"]];

oundView=backImageView;

[ addSubView:backImageView];

2.让cell透明

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

MyCell *cell = [tableViewdequeueReusableCellWithIdentifier:@"METext"forIndexPath:indexPath];

oundColor=[UIColor clearColor];//关键语句 ,设置背景为透明的 [cell setCellInfo:dic];//⾃定义类⽬⽅法

return cell;

}

发布者:admin,转转请注明出处:http://www.yc00.com/news/1689262794a226338.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信