5

我正在使用 Swift 3 创建一个 IOS 应用程序并实现 Eureka Forms。作为表单的一部分,我有一个用作删除按钮的按钮行。因此,我希望将文本颜色更改为白色。

我尝试了以下方法,但是单元格文本颜色会引发错误。关于我如何正确实现这一点的任何想法?

+++ Section("Delete Item")
  <<< ButtonRow() {
  $0.title = "Delete"
  }.cellSetup() {cell, row in
    cell.backgroundColor = UIColor.red
    cell.textLabel?.textColor = UIColor.whiteColor()
  }.onCellSelection {  cell, row in self.deleteItem() }
4

1 回答 1

6

你很接近,你必须使用tintColor而不是textColor,使用这个代码

 <<< ButtonRow() {
      $0.title = "Delete"
      }.cellSetup() {cell, row in
          cell.backgroundColor = UIColor.red
          cell.tintColor = UIColor.white
      }

在此处输入图像描述

我希望这可以帮助你

于 2017-03-13T21:26:13.073 回答