我添加了 Chameleon对一个项目来说,它在大多数情况下运作良好。我在为项目设置主题时遇到的一个问题是背景被放置在 UITableViewCell 配件上。
这是启用 ChameleonFramework
主题后我的配件的样子:
我想要的配饰颜色是没有背景的蓝色。变色龙似乎颠倒了这些。
我还打开了 Debug View Hierarchy 以查看发生了什么。我可以“看到”问题,但我无法弄清楚如何获取附件 View 的背景以将其改回 UIColor.white
,也无法弄清楚如何将复选标记更改为UIColor.blue
我尝试在 cellForRowAtIndexPath
中使用以下命令修改配件的色调:
cell.tintColor = UIColor.blue
我还尝试更改 accessoryView
的背景:
cell.accessoryView!.tintColor = UIColor.blue
cell.accessoryView?.backgroundColor = UIColor.white
我还尝试更改 tableView
的色调:
tableView.tintColor = UIColor.blue
非常感谢我将如何改变这一点的任何其他想法。
最佳答案
显然,这是目前正在处理的 Chameleon 的一个错误。
在 Debug View Hierarchy 中仔细研究,我看到复选标记被绘制为 UIButton
。当 UIButton 类包含在 UITableViewCell
中时,我选择更改 AppDelegate 中的 UIButton 类外观,而不是在 MyViewController
上更改它。
我能够通过从 AppDelegate 调用以下命令来解决我的问题:
UIButton.appearance(whenContainedInInstancesOf: [UITableViewCell.classForCoder() as! UIAppearanceContainer.Type]).backgroundColor = UIColor.clear
UIButton.appearance(whenContainedInInstancesOf: [UITableViewCell.classForCoder() as! UIAppearanceContainer.Type]).tintColor = FlatBlue()
关于ios - 删除 UITableView 附件上的背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40115837/