UITableViewCell的选中时的颜色设置
2016-03-14 13:29
330 查看
1.系统默认的颜色设置
//无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectionStyle = UITableViewCellSelectionStyleBlue; //灰色 cell.selectionStyle = UITableViewCellSelectionStyleGray;
2.自定义颜色和背景设置
改变UITableViewCell选中时背景色://通过RGB来定义自己的颜色 UIColor *color = [[UIColoralloc]initWithRed:0.0green:0.0blue:0.0alpha:1];
cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:cell.frame] autorelease]; cell.selectedBackgroundView.backgroundColor = [UIColor xxxxxx];
3.自定义UITableViewCell选中时背景
cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellart.png"]] autorelease]; //还有字体颜色 cell.textLabel.highlightedTextColor = [UIColor xxxcolor]; [cell.textLabel setTextColor:color];//设置cell的字体的颜色
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 = ...; } //... }
相关文章推荐
- iOS 拍照和视频录制(UIImagePickerController)
- 欧拉项目第14题 Longest Collatz sequence
- UITableView——点击某一行移动到指定位置
- 225. Implement Stack using Queues
- UVa 1584 - Circular Sequence
- 530 A secure connection is requiered(such as ssl)
- 关于在非UI线程中修改View
- Hadoop可视化分析利器之Hue
- MQTT学习笔记——MQTT协议体验 Mosquitto安装和使用
- UITableView-表格视图
- android studio 创建项目一直停留在building gradle project info
- [Getting and Cleaning data] Quiz 2
- pip自动生成requirements.txt依赖关系清单
- iOS输入视图(如UITextView UITextField)点击时没有弹出键盘输入窗
- UITableView和UITableViewCell的几种样式
- Inventor问题:LNK1104: 无法打开文件"x64\Debug\CustomUI.dll"
- 基于modern ui for wpf的在线公开课平台 之三 使用grid布局
- 使用串口连接Arduino与树莓派开发板
- request.getParameter和request.getAttribute之间的区别
- Mahout随机森林算法源码分析2BuildForest