【问题标题】:How to customise colours InAppSettingsKit?如何自定义颜色 InAppSettingsKit?
【发布时间】:2014-02-26 08:15:51
【问题描述】:

也许我遗漏了一些明显的东西,但似乎更改单元格颜色的唯一方法是更改​​ IASKAppSettingsViewController 和/或 IASKPSTextFieldSpecifierViewCell 中的代码。即使这样似乎也不适用于所有情况。

我正在使用 PSTextFieldSpecifier、PSToggleSwitchSpecifier 和 PSTitleValueSpecifier。

对于 PSTextFieldSpecifier,在

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier

我添加了这两行:

_textField.textColor = [UIColor whiteColor];
_textField.backgroundColor = [UIColor blackColor];

但是,这只改变了值的颜色,而不是标题的颜色。如何更改标题的颜色?

【问题讨论】:

  • 我自己没试过,但您是否尝试过使用 UIAppearance API 自定义颜色?
  • 哇!我刚试过,很简单。谢谢!
  • 但对表格中TextFields和标签的文字颜色无效。

标签: ios cocoa inappsettingskit


【解决方案1】:

最后,我使用 UIAppearance 设置单元格的背景,然后我添加了这个:

    cell.textLabel.textColor = [UIColor colorWithRed:0.0f green:122.0/255.0f blue:1.0f alpha:1.000f];
cell.detailTextLabel.textColor = [UIColor colorWithRed:0.0f green:122.0/255.0f blue:1.0f alpha:1.000f];

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

IASKAppSettingsViewController。

【讨论】:

  • 听起来不错。我建议子类化IASKAppSettingsViewController 来覆盖tableView: cellForRowAtIndexPath:。然后,您可以轻松更新到更新版本的 IASK。
猜你喜欢
  • 2011-12-05
  • 2015-07-14
  • 1970-01-01
  • 1970-01-01
  • 2020-12-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-24
相关资源
最近更新 更多