// 首先在tableView的代理方法中设置cell的选中样式为none
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
WXOrderStatusTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL" forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
// 在重写的cell里面
// 重写setHighlighted方法
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
if (highlighted == YES) {
// 选中时候的样式
self.bgView.backgroundColor = WColorRGB(240, 240, 240);
} else {
// 未选中时候的样式
self.bgView.backgroundColor = [UIColor whiteColor];
}
}