【发布时间】:2016-07-22 08:00:50
【问题描述】:
我正在尝试更改我的 didSelectRowtIndexPath 中 UITableview 的选择颜色。
let selectedCellColor = UIColor.init(red: 97.0/255.0, green: 196.0/255.0, blue: 185.0/255.0, alpha: 1)
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
{
print("tableView -> didSelectRowAtIndexPath")
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath)
cell.contentView.backgroundColor = selectedCellColor
cell.backgroundColor = selectedCellColor
}
不幸的是,虽然选择颜色变化,但是当我这样做时,文本被覆盖/不可见。
我进行了一些搜索,但似乎这是更改标准 UITableView 单元格选择颜色的最推荐解决方案。
我还尝试更改标签颜色,认为它可能会变得可见但没有运气。
cell.textLabel?.textColor = UIColor.whiteColor()
我错过了什么?
【问题讨论】:
-
你可能会找到答案here
标签: ios swift uitableview uicolor