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++ 中最好用的功能就是双击选中,本文档中所有相同的内容高亮 不过有个问题就是当文档特别大,而且注释比较多的时候,我选中的内容高亮为绿色不太好找,那怎么设置呢? 设置--语言格式设置-- ...
随机推荐
- django 模版语法及使用
模版的定义 模版是一个文本,用语分离文档的表现形式和内容,通常用于生成html 模版当中能够使用的python语法非常少,for ,if 之类,还有ifequal,结束的时候也要写endifequal ...
- ccc 播放动画
cc.Class({ extends: cc.Component, properties: { anim:cc.Animation, }, // use this for initialization ...
- Hadoop2.2.0 hive0.12 hbase0.94 配置问题记录
环境:centos6.2 Hadoop2.2.0 hive0.12 hbase0.94 1>hadoop配好之后,跑任务老失败,yarn失败,报out of memory错误,然后怎么调整内存大 ...
- hibernate.cfg.xml配置文件和hbm.xml配置文件
http://blog.sina.com.cn/s/blog_a7b8ab2801014m0e.html hibernate.cfg.xml配置文件格式 <?xml version=" ...
- 【BZOJ】2286: [Sdoi2011消耗战
http://www.lydsy.com/JudgeOnline/problem.php?id=2286 题意:n个点的边加权树,m个询问,每次询问给出的k个点与结点1分离的最小代价.(n<=2 ...
- 【bzoj2631】tree link-cut-tree
2016-06-01 08:50:36 题目:http://www.lydsy.com/JudgeOnline/problem.php?id=2631 注意加和乘的标记下传问题. 还有就是split后 ...
- This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
一,经历 <1> 使用SDWebImage下载 成功图片后,将图片设置给 self.imageView.image,提示如题所示的错误提示. <2>第一反应就是慢慢注释掉代码进 ...
- js-小效果-手风琴
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...
- 访问google,youtube
一.找到host文件 windows : C:\windows\system32\drivers\etc mac os: /private/etc linux : /etc 二.修改host文件 ht ...
- 前端自动化工具 -- fis 使用简介
https://github.com/fex-team/fis FIS入门: http://fis.baidu.com/docs/beginning/getting-started.html FIS ...