UITableViewCell的选中时的颜色设置
转自:http://hi.baidu.com/zhu410289616/item/0de0262910886011097508c2
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];//设置cell的字体的颜色
4.设置tableViewCell间的分割线的颜色
[theTableView setSeparatorColor:[UIColor xxxx ]];
5.十六进制字符串转uicolor
+(UIColor*)colorWithHexString:(NSString*)hexstring{
NSString*cString = [[hexstring stringByTrimmingCharactersInSet:[NSCharacterSetwhitespaceAndNewlineCharacterSet]] uppercaseString];
// String should be 6 or 8 characters
if([cString length] < 6) return[UIColorblackColor];
// strip 0X if it appears
if([cString hasPrefix:@"0X"]) cString = [cString substringFromIndex:2];
if([cString hasPrefix:@"#"]) cString = [cString substringFromIndex:1];
if([cString length] != 6) return[UIColorblackColor];
// Separate into r, g, b substrings
NSRangerange;
range.location= 0;
range.length= 2;
NSString*rString = [cString substringWithRange:range];
range.location= 2;
NSString*gString = [cString substringWithRange:range];
range.location= 4;
NSString*bString = [cString substringWithRange:range];
// Scan values
unsignedintr, g, b;
[[NSScannerscannerWithString:rString] scanHexInt:&r];
[[NSScannerscannerWithString:gString] scanHexInt:&g];
[[NSScannerscannerWithString:bString] scanHexInt:&b];
return[UIColorcolorWithRed:((float) r / 255.0f)
green:((float) g / 255.0f)
blue:((float) b / 255.0f)
alpha:1.0f];
}
UITableViewCell的选中时的颜色设置的更多相关文章
- iOS开发UITableViewCell的选中时的颜色设置(转)
iOS开发UITableViewCell的选中时的颜色设置 1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSelectionStyle ...
- 【转】iOS开发UITableViewCell的选中时的颜色设置
原文网址:http://mobile.51cto.com/hot-404900.htm 1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSe ...
- iOS开发UITableViewCell的选中时的颜色设置
1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectionStyle = ...
- iOS设置UITableViewCell的选中时的颜色
1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectio ...
- IOS - UITableViewCell的选中时的颜色及tableViewCell的selecte与deselecte
1.系统默认的颜色设置 [cpp] view plaincopy //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 ...
- UITableViewCell的选中时的颜色及tableViewCell的selecte与deselecte
1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectionStyle = ...
- iOS UITabBarItem 选中图的颜色,设置UIimage的渲染模式
UITbarController之前有在这篇文章讲解:http://www.cnblogs.com/niit-soft-518/p/4447940.html 如果自定义了UITabBarItem的图片 ...
- iOS设置cell选中时文字颜色的变化
cell.titleStr.highlightedTextColor = EMCGreenColor;
- notepad++中双击选中字符串高亮颜色设置
notepad++ 中最好用的功能就是双击选中,本文档中所有相同的内容高亮 不过有个问题就是当文档特别大,而且注释比较多的时候,我选中的内容高亮为绿色不太好找,那怎么设置呢? 设置--语言格式设置-- ...
随机推荐
- 一些有用的HTML5 pattern属性
最近在做手机页面时,遇到数字输入的键盘的问题,之前的做法只是一刀切的使用 type="tel",不过一直觉得九宫格的电话号码键盘上的英文字母太碍事了.于是想要尝试其它的实现方案,最 ...
- 洛谷 P1031 均分纸牌 Label:续命模拟QAQ
题目描述 有 N 堆纸牌,编号分别为 1,2,…, N.每堆上有若干张,但纸牌总数必为 N 的倍数.可以在任一堆上取若于张纸牌,然后移动. 移牌规则为:在编号为 1 堆上取的纸牌,只能移到编号为 2 ...
- HDU 1700 Points on Cycle(向量旋转)
题目链接 水题,卡了下下精度. #include <cstdio> #include <iostream> #include <cmath> using names ...
- C#_使用SMTP发送邮件
using System.Net; using System.Net.Mail; namespace ClassLibrary { /// <summary> /// 发送邮件 /// & ...
- Redis_Jedis使用总结
目录:1.pipeline2.跨jvm的id生成器3.跨jvm的锁实现(watch multi)4.redis分布式 1. Pipeline 官方的说明是:starts a pipeline,whic ...
- winform窗体最大化、最小化、还原
//最大化 private void button_maxsize_Click(object sender, EventArgs e) { this.WindowS ...
- java分享第一天(java环境及原理)
1 JDK的安装目录中:环境变量中增加JAVA_HOME变量:JDK安装目录:在path中添加JDK的bin目录 2 java执行的顺序是: 1 用java编译器javac XXX.java ...
- Centos 安装 NodeJS
准备命令: yum -y install gcc make gcc-c++ openssl-devel wget 下载源码及解压: wget http://nodejs.org/dist/v0.10. ...
- Big Chocolate
Big Chocolate 题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=19127 Big Chocolat ...
- angular.js学习笔记之一
angular也是一个MVC框架,其中M即model模型表示服务器,V即view视图代表html代码,C即control控制器用来处理用户交互的部分.