博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UITableViewCell背景色.选中背景色,分割线,字体颜色设置
阅读量:4580 次
发布时间:2019-06-09

本文共 1159 字,大约阅读时间需要 3 分钟。

[cpp]   
 
  1. 1.系统默认的颜色设置  
[cpp]   
 
  1. //无色  
  2. cell.selectionStyle = UITableViewCellSelectionStyleNone;  
  3.   
  4. //蓝色  
  5. cell.selectionStyle = UITableViewCellSelectionStyleBlue;  
  6.   
  7. //灰色  
  8. cell.selectionStyle = UITableViewCellSelectionStyleGray;  

 

2.自定义颜色和背景设置

 改变UITableViewCell选中时背景色:

 

UIColor *color = [[UIColoralloc]initWithRed:0.0green:0.0blue:0.0alpha:1];//通过RGB来定义自己的颜色

[html]   
 
  1. cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:cell.frame] autorelease];  
  2. cell.selectedBackgroundView.backgroundColor = [UIColor xxxxxx];  

 

 

3自定义UITableViewCell选中时背景

[html]   
 
  1. cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellart.png"]] autorelease];   
  2. 还有字体颜色   
  3. 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 = ...; } ... }

转载于:https://www.cnblogs.com/W-Kr/p/5498853.html

你可能感兴趣的文章
NIO selector
查看>>
MySQL中DATETIME、DATE和TIMESTAMP类型的区别
查看>>
asp代码获取年数,季度数.星期数,天数,小时数,分钟数,秒数等时
查看>>
python之建完model之后操作admin
查看>>
Java 类加载机制 ClassLoader Class.forName 内存管理 垃圾回收GC
查看>>
shell 脚本后台运行知识
查看>>
php设置cookie,在js中如何获取
查看>>
实验三+099+吴丹丹
查看>>
[bzoj3036]绿豆蛙的归宿
查看>>
[洛谷P5057][CQOI2006]简单题
查看>>
多线程同步的几种方法
查看>>
地图编辑器V3
查看>>
Neo4j-cypher语言
查看>>
maven简识
查看>>
查看Linux硬件配置信息
查看>>
python基础部分----文件、copy、内存指针
查看>>
poj 3283 Card Hands
查看>>
line-height
查看>>
bzoj2330 糖果
查看>>
【转】jira迁移数据
查看>>