UITableViewCell的选中时的颜色及tableViewCell的selecte与deselecte

本文主要是介绍UITableViewCell的选中时的颜色及tableViewCell的selecte与deselecte,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.系统默认的颜色设置

[objc] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. //无色  
  2. cell.selectionStyle = UITableViewCellSelectionStyleNone;  
  3.   
  4. //蓝色  
  5. cell.selectionStyle = UITableViewCellSelectionStyleBlue;  
  6.   
  7. //灰色  
  8. cell.selectionStyle = UITableViewCellSelectionStyleGray;</span>  

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

 改变UITableViewCell选中时背景色:

[objc] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. UIColor *color = [[UIColoralloc]initWithRed:0.0green:0.0blue:0.0alpha:1];//通过RGB来定义自己的颜色  
[objc] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:cell.frame] autorelease];  
  2. cell.selectedBackgroundView.backgroundColor = [UIColor xxxxxx];  

3自定义UITableViewCell选中时背景
[objc] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. // Customize the appearance of table view cells.  
  2. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath  
  3. {  
  4.   if(0 == indexPath.row)  
  5.   {  
  6.     cell.textLabel.textColor = ...;  
  7.     cell.textLabel.highlightedTextColor = ...;  
  8.   }  
  9.   ...  
  10. }  


[objc] view plain copy 在CODE上查看代码片 派生到我的代码片
  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间的分割线的颜色

[objc] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [theTableView setSeparatorColor:[UIColor xxxx ]];  

5、设置cell中字体的颜色
[objc] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. // Customize the appearance of table view cells.  
  2. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath  
  3. {  
  4.   if(0 == indexPath.row)  
  5.   {  
  6.     cell.textLabel.textColor = ...;  
  7.     cell.textLabel.highlightedTextColor = ...;  
  8.   }  
  9.   ...  
  10. }  

转自: http://blog.csdn.net/a6472953/article/details/7532212#

这篇关于UITableViewCell的选中时的颜色及tableViewCell的selecte与deselecte的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/319550

相关文章

渐变颜色填充

GradientFill函数可以对特定的矩形区域或者三角形区域进行渐变颜色的填充。我们先来看看GradientFill函数到底长得什么样子,帅不帅。 [cpp]  view plain copy print ? BOOL GradientFill(     _In_  HDC hdc,     _In_  PTRIVERTEX pVertex,     _In_  ULONG

【虚拟机/服务器】非图形化界面下修改Shell中颜色的设置

1、首先 cd ~ && ll 可以看到如下图所示 2、输入 sudo vim .bashrc 进入 .bashrc 并通过 /PS1 迅速从上往下定位第一个PS1 3、输入 i 进入插入模式后修改 else 下面的配置如下 说明:\e[1;32;40m] 其中1表示高亮显示,32表示字体颜色是绿色,40表示背景色为黑色 4、输入 esc 退出编辑模式到命令模式,再输入

学习整理使用jquery实现获取相同name被选中的多选框值的方法

学习整理使用jquery实现获取相同name被选中的多选框值的方法 <html><head><meta charset="gbk"><!-- 引入JQuery --><script src="https://www.qipa250.com/jquery/dist/jquery.min.js" type="text/javascript"></script></head><body>

Excel查询颜色RGB值

1.选中单元格,点右键,设置单元格格式-填充-其他颜色-自定义,下面显示的就是该单元格颜色的RGB值 2.与十六进制换算: https://www.sioe.cn/yingyong/yanse-rgb-16/

HSV颜色空间和RGB颜色空间相互转换C语言实现

HSV(Hue, Saturation, Value)是根据颜色的直观特性由A. R. Smith在1978年创建的一种颜色空间, 也称六角锥体模型(Hexcone Model)。这个模型中颜色的参数分别是:色调(H),饱和度(S),明度(V)。 色调H 用角度度量,取值范围为0°~360°,从红色开始按逆时针方向计算,红色为0°,绿色为120°,蓝色为240°。它们的补色是:黄色为60°,青色

js 控制 checkbox不选中

js 控制 checkbox不选中 $("input[name=‘myName’]").prop("checked",false);

CSS学习6--背景图片、颜色、位置、附着、简写、透明、缩放、多背景、凹凸文字、导航栏例子

CSS背景 一、背景颜色和图片二、背景位置三、背景附着四、背景简写五、背景透明六、背景缩放七、多背景八、凹凸文字九、导航栏例子 一、背景颜色和图片 background-color: pink; 背景颜色backgroundoimage: url(##.jpg); 背景图片background-repeat: 平铺 repeat-x横向平铺,repeat-y纵向平铺; 平铺不到

前端百科---点击文字选中Radio

在进行Web过程中,Radio单选是必不可少的.但是如果用户只能通过点击Radio的圆圈才能实现选项的选择,这样就会导致交互不够好...       怎么解决呢?使用JavaScript当然可以,但是直接使用HTML5自带属性不是更好吗?       废话少说,直接上demo:       第一种:label标签使用for属性指向input:radio;       第二