首页 > 其他 > 详细

设置 tableview 的背景 颜色 和清空

时间:2016-04-09 10:24:03      阅读:216      评论:0      收藏:0      [点我收藏+]

表示图中Cell默认是不透明的,那么在设置表示图的背景颜色和图片时通常是看不到的

 

 

1.给tableView设置背景view 

  UIImageView *backImageView=[[UIImageViewalloc]initWithFrame:self.view.bounds]; 

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

    self.tableView.backgroundView=backImageView; 

[self.view addSubView:backImageView];

   

2.让cell透明 

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

       

    

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

    cell.backgroundColor=[UIColor clearColor];//关键语句 ,设置背景为透明的

    [cell setCellInfo:dic];//自定义类目方法 

     return cell; 

       

}

设置 tableview 的背景 颜色 和清空

原文:http://www.cnblogs.com/meixian/p/5370861.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!