//设置点击选中时的背景色
UIView *selectedViewBg = [[UIView alloc]initWithFrame:cell.frame];
selectedViewBg.backgroundColor = [UIColor orangeColor];
cell.selectedBackgroundView = selectedViewBg;
iOS—UITableViewCell设置点击时的高亮颜色
这段代码演示了如何在iOS应用中自定义UITableView的单元格(cell)在被点击时的背景颜色,通过创建一个UIView并设置其背景色为橙色,然后将其赋值给cell的selectedBackgroundView属性,实现点击时显示橙色背景的效果。
摘要由CSDN通过智能技术生成