Search code examples
iosswifteureka-forms

Eureka form: change TextField color does not work


I use Eureka form and want to change text color of the input field. I tried everything to change text color of textfield in a Row of Eureka form but it does not work.

I tried to change textColor and also attributedText but nothing happened.

<<< IntRow() {
            $0.title = "Title"
            $0.value = 2020
        }.cellSetup({ (cell, row) in
            cell.textLabel?.font  = .boldSystemFont(ofSize: 18)
            cell.detailTextLabel?.textColor = UIColor.systemOrange
            cell.textField.textColor = UIColor.red
            cell.textField.attributedText = NSAttributedString(string: "123", attributes: [
                .foregroundColor: UIColor.red
            ])

Any help? Thanks!


Solution

  • I found that we cannot update the UITextField in cellSetup. Instead, I have to update the style in cellUpdate.

    .cellUpdate({ (cell, row) in
                    cell.textField.font = .boldSystemFont(ofSize: 18)
                    cell.textField.textColor = UIColor.systemOrange
                })