siwft入门-UITableViewCell颜色
来源:互联网 发布:linux改用户权限 编辑:程序博客网 时间:2024/04/28 10:55
June 19,2014
UITableViewCell的选中时的颜色UITableViewCell颜色及tableViewCell的selecte与deselecte
[cpp] view plaincopy
- 1.系统默认的颜色设置
- //无色
- cell.selectionStyle
= UITableViewCellSelection StyleNone; -
- //蓝色
- cell.selectionStyle
= UITableViewCellSelection StyleBlue; -
- //灰色
- cell.selectionStyle
= UITableViewCellSelection StyleGray;
2.自定义颜色和背景设置
UIColor
- 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 ]];
4.pop返回table时,cell自动取消选中状态
首先我有一个UITableViewController,其中每个UITableViewCell点击后都会push另一个ViewController,每次点击Cell的时候,Cell都会被选中,当从push的ViewController返回的时候选中的Cell便会自动取消选中。后来由于某些原因我把这个UITableViewController改成了UIViewController,之后就产生了一个问题:每次返回到TableView的时候,之前选中的Cell不能自动取消选中,经过查找得知:
UITableViewController有一个clearsSelectionOnViewWil
而当把UITableViewController修改成UIViewController后,这个属性自然就不存在了,因此我们必须手动添加取消选中的功能,方法很简单,在viewWillAppear方法中加入:
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
6.点击后,过段时间cell自动取消选中
}
- (void)deselect
{
}
- siwft入门-UITableViewCell颜色
- UITableViewCell 颜色修改
- 设置UITableViewCell选中的颜色
- 设置UITableViewCell选中的颜色
- uitableviewcell选中后颜色更改
- UITableViewCell设置选中背景颜色
- UITableViewCell点击时背景颜色
- 自定义UITableViewCell的背景颜色
- UITableViewCell点击时背景颜色
- 设置UITableViewCell选中的颜色
- UITableViewCell点击时背景颜色
- UITableViewCell点击时背景颜色
- UITableViewCell的背景颜色设置
- 自定义UITableViewCell的背景颜色
- 修改uitableViewCell选中时颜色
- UITableViewCell的选中颜色修改
- UITableViewCell点击时背景颜色
- siwft初学(一)
- 黑马程序员-高新技术Java 1.5特性之的注解(依据张老师视频和网上资料)
- 经纬财富:焦作现货白银投资三大技巧
- 我的第一个小爬虫
- 编辑文章 - 博客频道 - CSDN.NET
- COCOS2DX WIN32 版本的CPU占用25%改良策略
- siwft入门-UITableViewCell颜色
- C#异常处理及心得
- Android中String处理
- JPA的优点
- 许巍许巍,还是许巍
- Java中的匿名内部类总结
- JSON.parse()和JSON.stringify()
- 333
- Lua 中模拟 类