iOS开发UITableViewCell的选中时的颜色设置(转)
iOS开发UITableViewCell的选中时的颜色设置
1.系统默认的颜色设置
- //无色
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- //蓝色
- cell.selectionStyle = UITableViewCellSelectionStyleBlue;
- //灰色
- cell.selectionStyle = UITableViewCellSelectionStyleGray;
2.自定义颜色和背景设置
改变UITableViewCell选中时背景色:
- UIColor *color = [[UIColoralloc]initWithRed:0.0green:0.0blue:0.0alpha:1];//通过RGB来定义自己的颜色
- 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]
4.设置tableViewCell间的分割线的颜色
- [theTableView setSeparatorColor:[UIColor xxxx ]];
5、设置cell中字体的颜色
Prettyprint代码
- <span style="color: #888888;" class="com">// Customize the appearance of table view cells.</span><span style="color: #000000;" class="pun">-</span><span style="color: #000000;" class="pun">(</span><span style="color: #000088;" class="typ">UITableViewCell</span><span style="color: #000000;" class="pun">*)</span><span style="color: #000000;" class="pln">tableView</span><span style="color: #000000;" class="pun">:(</span><span style="color: #000088;" class="typ">UITableView</span><span style="color: #000000;" class="pun">*)</span><span style="color: #000000;" class="pln">tableView cellForRowAtIndexPath</span><span style="color: #000000;" class="pun">:(</span><span style="color: #000088;" class="typ">NSIndexPath</span><span style="color: #000000;" class="pun">*)</span><span style="color: #000000;" class="pln">indexPath
- </span><span style="color: #000000;" class="pun">{</span><span style="color: #000000;" class="pln">
- </span><span style="color: #880000;" class="kwd">if</span><span style="color: #000000;" class="pun">(</span><span style="color: #006666;" class="lit">0</span><span style="color: #000000;" class="pun">==</span><span style="color: #000000;" class="pln"> indexPath</span><span style="color: #000000;" class="pun">.</span><span style="color: #000000;" class="pln">row</span><span style="color: #000000;" class="pun">)</span><span style="color: #000000;" class="pln">
- </span><span style="color: #000000;" class="pun">{</span><span style="color: #000000;" class="pln">
- cell</span><span style="color: #000000;" class="pun">.</span><span style="color: #000000;" class="pln">textLabel</span><span style="color: #000000;" class="pun">.</span><span style="color: #000000;" class="pln">textColor </span><span style="color: #000000;" class="pun">=</span><span style="color: #000000;" class="pun">...;</span><span style="color: #000000;" class="pln">
- cell</span><span style="color: #000000;" class="pun">.</span><span style="color: #000000;" class="pln">textLabel</span><span style="color: #000000;" class="pun">.</span><span style="color: #000000;" class="pln">highlightedTextColor </span><span style="color: #000000;" class="pun">=</span><span style="color: #000000;" class="pun">...;</span><span style="color: #000000;" class="pln">
- </span><span style="color: #000000;" class="pun">}</span><span style="color: #000000;" class="pln">
- </span><span style="color: #000000;" class="pun">...</span><span style="color: #000000;" class="pun">}</span>
iOS开发UITableViewCell的选中时的颜色设置(转)的更多相关文章
- 【转】iOS开发UITableViewCell的选中时的颜色设置
原文网址:http://mobile.51cto.com/hot-404900.htm 1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSe ...
- iOS开发UITableViewCell的选中时的颜色设置
1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectionStyle = ...
- UITableViewCell的选中时的颜色设置
转自:http://hi.baidu.com/zhu410289616/item/0de0262910886011097508c2 1.系统默认的颜色设置 //无色 cell.selectionSty ...
- IOS - UITableViewCell的选中时的颜色及tableViewCell的selecte与deselecte
1.系统默认的颜色设置 [cpp] view plaincopy //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 ...
- iOS设置UITableViewCell的选中时的颜色
1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectio ...
- UITableViewCell的选中时的颜色及tableViewCell的selecte与deselecte
1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectionStyle = ...
- iOS开发UI篇—iOS开发中三种简单的动画设置
iOS开发UI篇—iOS开发中三种简单的动画设置 [在ios开发中,动画是廉价的] 一.首尾式动画 代码示例: // beginAnimations表示此后的代码要“参与到”动画中 [UIView b ...
- iOS UITabBarItem 选中图的颜色,设置UIimage的渲染模式
UITbarController之前有在这篇文章讲解:http://www.cnblogs.com/niit-soft-518/p/4447940.html 如果自定义了UITabBarItem的图片 ...
- iOS:扩展UIColor,支持十六进制颜色设置
来自转载:http://my.oschina.net/leejan97/blog/307491 摘要: 可以直接使用十六进制设置控件的颜色,而不必通过除以255.0进行转换 #define UICol ...
随机推荐
- [Android]--RadioGroup+RadioButton实现底部导航栏
RadioGroup+RadioButton组合方式打造简单实用的底部导航栏 代码块: <?xml version="1.0" encoding="utf-8&qu ...
- 英尺和米之间的转换 Exercise06_09
/** * @author 冰樱梦 * 时间:2018年下半年 * 题目:英尺和米之间的转换 * */ public class Exercise06_09 { public static void ...
- 关于Hadoop_env.sh中的HADOOP_CLASSPATH
之前博客里介绍了如何自定义DoubleArrayWritable,并将该类型的value写入SequenceFile文件中,为了能够使用命令查看这个文件中的内容(果然坑都是一步一步给自己挖的)参考了网 ...
- angualrjs2教程
1.一本本开源的Angular2书籍:https://zhangchen915.gitbooks.io/angular2-training/ 2.好的博客教程,讲的通俗易懂:http://codin. ...
- CentOS 6.9使用Setup配置网络(解决dhcp模式插入网线不自动获取IP的问题)
说明:dhcp模式插入网线不自动获取IP是因为网卡没有激活,造成这种原因的,应该是安装系统时没有插入网线造成的. 解决方法: 修改网卡配置文件 vim /etc/sysconfig/network-s ...
- Idea下Android的配置
(1) 下载安装好Intellij Idea和Android SDK. (2) Android SDK设置 ,在FIle –> Other Settings –> Default Proj ...
- struts2文件上传时获取上传文件的大小
利用struts2框架上传文件时,如果想要获取上传文件的大小可以利用下面的方式进行: FileInputStream ins = new FileInputStream(file); if (ins. ...
- Swing:LookAndFeel 教程第一篇——手把手教你写出自己的 LookAndFeel
本文是 LookAndFeel 系列教程的第一篇. 是我在对 Swing 学习摸索中的一些微薄经验. 我相信,细致看全然系列之后.你就能写出自己的 LookAndFeel. 你会发现 Swing 原来 ...
- Android手掌抑制功能的实现
近期须要实现一个功能,在Activity中有一个手写区域,为了更好的用户体验,须要满足即使整个手掌放在屏幕上时(android平板,屏幕比較大)也仅仅响应手写区域内的操作,即在支持多点触控的情况下,仅 ...
- mapreduce实现搜索引擎简单的倒排索引
使用hadoop版本为2.2.0 倒排索引简单的可以理解为全文检索某个词 例如:在a.txt 和b.txt两篇文章分别中查找统计hello这个单词出现的次数,出现次数越多,和关键词的吻合度就越高 现有 ...