美文网首页
UITableViewCell的一些设置

UITableViewCell的一些设置

作者: 哪有猫不吃鱼 | 来源:发表于2020-04-22 11:17 被阅读0次

当cell.accessoryType = UITableViewCellAccessoryCheckmark;

设置√的颜色

 cell.tintColor = [[UIColor alloc]initWithRed:151/255.0  green:196/255.0 blue:68/255.0 alpha:1];

设置tableview背景

UIImageView *backImageView=[[UIImageView alloc]initWithFrame:self.tableView.bounds];

     [backImageViewsetImage:[UIImageimageNamed:@"bg"]];

     self.tableView.backgroundView=backImageView;

设置点击cell时高亮的颜色

  UIColor*color = [[UIColoralloc]initWithRed:151/255.0  green:196/255.0blue:68/255.0alpha:0.3];

    //通过RGB来定义自己的颜色

    cell.selectedBackgroundView = [[UIView alloc]initWithFrame:cell.frame];

     cell.selectedBackgroundView.backgroundColor = color;

 cell文本颜色颜色

    cell.textLabel.textColor = [UIColor whiteColor];

    cell.detailTextLabel.textColor = [UIColor whiteColor];

取消cell的点击时高亮状态

cell.selectionStyle = UITableViewCellSelectionStyleNone;

取消cell选中状态- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ // 取消选中状态

[tableView deselectRowAtIndexPath:indexPath animated:NO];

}

相关文章

网友评论

      本文标题:UITableViewCell的一些设置

      本文链接:https://www.haomeiwen.com/subject/lmwbihtx.html