[英]Is it possible to have a placeholder in the cell.detailTextLabel of a UITableViewCell
[英]Change UITableView cell.detailTextLabel colour on highlight
选定时,UITableView中文本的默认颜色是白色。 我想将其更改为深灰色。 通过执行以下操作,我设法更改了主标题标签文本:
cell.selectedTextColor = [UIColor darkGrayColor];
虽然高亮显示/选择了detailTextLabel,我该怎么做?
谢谢
您可以继承UITableViewCell。 然后覆盖setHighlighted:animated方法:
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[super setHighlighted:highlighted animated:animated];
if (highlighted) {
self.detailTextLabel.textColor = [UIColor lightGrayColor];
} else {
self.detailTextLabel.textColor = [UIColor whiteColor];
}
}
您可能最终还是想覆盖setSelected:animated方法。
只需使用:
cell.detailTextLabel.highlightedTextColor = [UIColor blueColor];
cell.detailTextLabel.textColor = [UIColor blue color];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.