iOS UItableviewcell选择背景颜色和字体颜色设置

来源:互联网 发布:荣威rx5 新款有优化吗 编辑:程序博客网 时间:2024/05/20 20:01

在iOS7之后,cell的选中样式UITableviewcellStyleBlue不再变为蓝色。
官方文档:
UITableViewCellSelectionStyleBlue
The cell has a default background color when selected.
In iOS 7, the selection color is no longer blue. Use UITableViewCellSelectionStyleDefault instead.(iOS7之后,选中颜色不再是蓝色,而是默认色)
如果要自定义背景颜色,需要通过selectedBackgroundView来设置cell选中时的背景颜色。
同时在cell被选中时,cell的textlabel上字体的颜色通过highlightedTextColor来进行自定义设置。

0 0