码迷,mamicode.com
首页 > 移动开发 > 详细

iOS设置UITableViewCell的背景色透明和选中颜色的方法

时间:2015-08-11 12:26:41      阅读:309      评论:0      收藏:0      [点我收藏+]

标签:

1.设置UITableViewCell的背景色透明方法:

cell.backgroundColor=[UIColor clearColor];

或者设置颜色透明度为0:

cell.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.0f];

2.设置UITableViewCell的选中颜色的方法:

    UIView *view = [[UIView alloc]init];
    view.backgroundColor=[UIColor redColor];
    cell.selectedBackgroundView=view;

另,设置UITableViewCell的选中字体颜色的方法:

cell.selectedTextColor=[UIColor blackColor];//默认显示为白色

但是这段代码会产生一个警告,‘selectedTextColor‘ is deprecated : first deprecated in iOS 3.0,苹果表示已不建议使用。

iOS设置UITableViewCell的背景色透明和选中颜色的方法

标签:

原文地址:http://my.oschina.net/SupermanGC/blog/490639

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!