UITableViewCell的选中时的颜色设置
2016-05-29 22:01
405 查看
转自CharlesBein_卞
** 1.系统默认的颜色设置 **
//无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectionStyle = UITableViewCellSelectionStyleBlue; //灰色 cell.selectionStyle = UITableViewCellSelectionStyleGray;
2.自定义颜色和背景设置
改变UITableViewCell选中时背景色: UIColor *color = [[UIColoralloc]initWithRed:0.0green:0.0blue:0.0alpha:1];//通过RGB来定义自己的颜色 [html] view plain copy cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame ]; cell.selectedBackgroundView.backgroundColor = [UIColor xxxxxx];
3.自定义UITableViewCell选中时背景
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellart.png"]]; // 还有字体颜色 cell.textLabel.highlightedTextColor = [UIColor xxxcolor]; //设置cell的字体的颜色 [cell.textLabel setTextColor:color];
4.设置tableViewCell间的分割线的颜色
[theTableView setSeparatorColor:[UIColor xxxx ]];
5、设置cell中字体的颜色
// Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if(0 == indexPath.row) { cell.textLabel.textColor = ...; cell.textLabel.highlightedTextColor = ...; } ... }
相关文章推荐
- Bluemix云端数据库服务使用示例———PHP投票程序
- [2015-11-04 21:42:47 - UIWidgetTest] res\drawable-hdpi-v4\Lighthouse.png: Invalid file name: must co
- FluentValidation
- BlockingQueue 实现解析
- 4、在JavaWeb里面,常用的request2Bean的实现
- Hibernate:Caused by: java.sql.SQLException: Incorrect string value: '\xE8\x8F异常
- CruiseControl初探
- 无法点击,无法获取inputvalue值得原因
- LightOJ 1154 - Penguins 最大流
- Git Github jekyll,gem Liquid模板语言 Markdown
- disque基本流程介绍
- 安卓前端 UI框架
- Android---相册getContentResolver().query结果为空指针
- Android UI开发中LayoutParams的应用
- [置顶] Android 6.0 Marshmallow 通知栏中QuickSetting分析
- Java之GUI-------边界布局管理器
- java之GUI-------JButton的使用
- java之GUI-----初涉窗体
- GUI
- iOS AutoLayout: 关联 Xib 和 UIView