iOS开发UITableViewCell的选中时的颜色设置
2014-03-22 19:41
459 查看
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 ]];
//无色
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 ]];
相关文章推荐
- UIButton 设置圆角 边框颜色 点击回调方法
- UIView加边框及边框颜色
- 关于tableviewcell的一些属性
- UISearchBar 自定义,加背景,取消按钮背景
- 判断滑动方向UITableView
- UE4学习笔记_01
- UITableView UITableViewStylePlain模型下 取消headerView的黏结性
- window.open("url?param="+paramvalue) 服务端 乱码问题解决
- 交互设计、信息图、信息可视化、数据可视化技术资源汇总——设计师的领域,设计师说了算
- xml读取异常Invalid byte 1 of 1-byte UTF-8 sequence
- Request 分别获取具有相同 name 属性表单元素值
- Android UI开发第四十一篇——墨迹天气3.0引导界面及动画实现
- 多线程下NSOperation、NSBlockOperation、NSInvocationOperation、NSOperationQueue的使用
- iOS学习之UINavigationController详解与使用(三)ToolBar
- iOS学习之UINavigationController详解与使用(三)ToolBar
- EasyUI datagrid 明细表格中编辑框 事件绑定 及灵活计算 可根据此思路 扩展其他
- 获取UIview的viewcontroller
- iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController
- iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController
- iOS学习之UINavigationController详解与使用(一)添加UIBarButtonItem