我对细胞的accessoryType
有疑问。我正在使用一个带有disclosureIndicator
作为accessoryType
的单元格,我想改变它的颜色,但我不能。有人知道这是一个bug还是苹果强迫我使用灰色的颜色吗?实际上,我可以改变其他accessoryType
的颜色。
我的代码如下所示:
let cell = tableView.dequeueReusableCell(withIdentifier: "identifier", for: indexPath) as! customCell
cell.tintColor = UIColor.red
cell.accessoryType = .disclosureIndicator
我的箭仍然是灰色的。但是如果我使用一个复选标记accessoryType
,它就会变成红色。
有什么办法可以解决这个问题吗?还是我必须使用彩色图像?
发布于 2020-03-24 01:46:22
使用SF符号
let image = UIImage(systemName: "chevron.right")
let accessory = UIImageView(frame:CGRect(x:0, y:0, width:(image?.size.width)!, height:(image?.size.height)!))
accessory.image = image
// set the color here
accessory.tintColor = UIColor.white
cell.accessoryView = accessory
https://stackoverflow.com/questions/44927146
复制相似问题