【转】iOS开发UITableViewCell的选中时的颜色设置
原文网址:http://mobile.51cto.com/hot-404900.htm
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的选中时的颜色设置(转)
iOS开发UITableViewCell的选中时的颜色设置 1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSelectionStyle ...
- 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开发中滑动页面时NSTimer停止的问题
我们在做倒计时的时候,发现当你手指按着屏幕不放,拖动tableView滑动的时候,写在cell上得倒计时停止倒计时,松开继续倒计时.研究发现就是拖动tableView滑动时,NSTimer停止了. 这 ...
随机推荐
- jstl表达式使用方法
1.jstl.jar servlet.jar支持 2.jsp引入标签库 <%@ taglib prefix="c" uri="http://java.sun.co ...
- zju 2972 Hurdles of 110m(简单的dp)
题目 简单的dp,但是我还是参考了网上的思路,具体我没考虑到的地方见代码 #include<stdio.h> #include<iostream> #include<st ...
- 枚举|标志枚举+|(或)和&(与)运算|类型转换|值类型和引用类型|传参|异常|垃圾回收
枚举部分 enum 关键字用于声明枚举,即一种由一组称为枚举数列表的命名常量组成的独特类型. 通常情况下,最好是在命名空间内直接定义枚举,以便该命名空间中的所有类都能够同样方便地访问它. 但是,还可以 ...
- 搭建网站 discuzx ecshop php
1.http://www.comsenz.com/downloads/install/discuzx下载
- [topcoder]PackingBallsDiv2
http://community.topcoder.com/stat?c=problem_statement&pm=12995 简单题 class PackingBallsDiv2 { pub ...
- *[topcoder]TaroFriends
http://community.topcoder.com/stat?c=problem_statement&pm=13005 好题.最暴力是试验2^n种跳法.然后有从结果入手,那么最终的左右 ...
- Sina App Engine(SAE)教程(11)- Yaf使用
Yaf参考资料 Yaf(Yet Another Framework)用户手册 想在SAE使用Yaf? 无需申请,sae环境已经全面支持. Yaf 实战 下面是一个运行在SAE的Yaf的hello wo ...
- C编译过程概述
转自:http://my.oschina.net/apeng/blog/105245 C 编译过程概述 目前Linux下最常用的C语言编译器是GCC(GNU Compiler Collection), ...
- C程序的内存分配
一.预备知识-程序的内存分配 一个由C/C++编译的程序占用的内存分为以下几个部分 1.栈区(stack)- 由编译器自动分配释放,存放函数的参数值,局部变量的值等.其操作方式类似于数据结构中的栈. ...
- Hibernate逍遥游记-第10章 映射继承关系-002继承关系树中的根类对应一个表(discriminator、subclass)
1. 2. <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate ...