Swift 3 Eureka Forms更改按钮行字体颜色

时间:2017-03-13 21:13:32

标签: ios swift3 eureka-forms

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

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

+++ 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() }

1 个答案:

答案 0 :(得分:6)

即将结束,您必须使用tintColor代替textColor,请使用此代码

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

enter image description here

我希望这有助于你