在 UITableViewCell 上调暗 tintColor

Posted

技术标签:

【中文标题】在 UITableViewCell 上调暗 tintColor【英文标题】:Dimming a tintColor on a UITableViewCell 【发布时间】:2013-09-17 16:27:46 【问题描述】:

这是一个打开模式的 UITableViewCell(“添加成分”):

我正在设置标签颜色以匹配应用程序的 tintColor:

cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
cell.textLabel.text = @"Add Ingredients...";
cell.textLabel.textColor = [self.view tintColor];

当出现UIAlertViewUIActionSheet 时,如何使文本颜色变暗?此行为是按钮和其他控件的默认行为,但不适用于单元格的文本标签。

我找到了对 tintAdjustmentMode 和 tintColorDidChange 的引用,但都不知道如何使用。

或者我应该在我的单元格中添加一个按钮?我之前对这种方法的体验并不是最佳的 - 响应能力有副作用。

【问题讨论】:

【参考方案1】:

我相信你是对的。您应该能够在您的 CustomUITableViewCell 中覆盖 tintColorDidChange 方法。

http://www.qubop.com/ios7.pdf

【讨论】:

我明白了 - 所以我需要使用自定义单元子类而不是标准单元之一。我会试试这个。

以上是关于在 UITableViewCell 上调暗 tintColor的主要内容,如果未能解决你的问题,请参考以下文章