ios - 删除 UITableView 附件上的背景颜色

标签 ios swift xcode uitableview

我添加了 Chameleon对一个项目来说,它在大多数情况下运作良好。我在为项目设置主题时遇到的一个问题是背景被放置在 UITableViewCell 配件上。

这是启用 ChameleonFramework 主题后我的配件的样子:

enter image description here

我想要的配饰颜色是没有背景的蓝色。变色龙似乎颠倒了这些。

我还打开了 Debug View Hierarchy 以查看发生了什么。我可以“看到”问题,但我无法弄清楚如何获取附件 View 的背景以将其改回 UIColor.white,也无法弄清楚如何将复选标记更改为UIColor.blue

enter image description here

我尝试在 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/

相关文章:

xcode - [IOS SDK]-touchesBegan 以特定对象开始?

objective-c - 添加推送通知时的 Bundle ID 问题

objective-c - iOS 8 方向改变 : Keyboard frame does not display correctly

javascript - Phonegap 应用程序 SQLite 数据库初始设置

iphone - 适用于 iOS SDK 的 Magento oauth api

ios - 通过 swift 立即使用 SdWebImage 和 Image Change

swift - WatchOS 2 文本/表格上基于页面的点

ios - Apple 对使用 UIKit 中的隐藏图标有何看法

ios - 如何在 swift iOS 中通过 nsurlsession 为 REST API 创建全局函数?

swift - 从核心数据中保存 CKAsset