Eureka: ButtonRowのテキストの色を変更するにはどうすればよいですか?

作成日 2016年07月17日  ·  3コメント  ·  ソース: xmartlabs/Eureka

次を使用して、ButtonRowの白いテキストで青い背景を作成しようとしています。

            <<< ButtonRow("Login") {
                $0.title = "Login"
                }.onCellSelection({[weak self] row in
                    self!.handleLogin()
                }).cellSetup { cell, row in
                    cell.textLabel?.textColor = UIColor.whiteColor()
                    cell.backgroundColor = UIColor.blueColor()
                }

screen shot 2016-07-16 at 4 42 17 pm
それはtintColorのままです

最も参考になるコメント

次のようにcellUpdateメソッドでtextColorを設定してみてください

<<< ButtonRow ("Login") { $0.title = "Login" }.cellUpdate { cell, row in cell.textLabel?.textColor = UIColor.whiteColor() cell.backgroundColor = UIColor.blueColor() }

全てのコメント3件

次のようにcellUpdateメソッドでtextColorを設定してみてください

<<< ButtonRow ("Login") { $0.title = "Login" }.cellUpdate { cell, row in cell.textLabel?.textColor = UIColor.whiteColor() cell.backgroundColor = UIColor.blueColor() }

よろしくお願いします。cellSetupの代わりにcellUpdateを使用すると機能します。

ここでは、セルのtintColorプロパティを使用することをお勧めします。

logoutRow = ButtonRow() { row in
    row.title = "Logout".localized
    row.cell.textLabel?.font = font
    row.cell.tintColor = UIColor(rgb: 0xE25564) 
}
このページは役に立ちましたか?
0 / 5 - 0 評価