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条)