iOS:改变UITableViewCell的选中背景色

时间:2014-09-19 13:35:35   收藏:0   阅读:274

要改变UITableViewCell选中时的背景色,需要在
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)方法中添加如下代码:

// 设置cell选中的背景色
UIView *selectionColor = [[UIView alloc] init];
selectionColor.backgroundColor = [UIColor colorWithRed:(2/255.0)
                                                 green:(94/255.0)
                                                  blue:(130/255.0)
                                                 alpha:1];
cell.selectedBackgroundView = selectionColor;

即可。

原文:http://www.cnblogs.com/ilovewindy/p/3977907.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!