我有一个拉动来刷新我的应用程序。
如何更改 attributedTitle 的文本颜色?
refresher.attributedTitle = NSAttributedString(string: "hey ! is there something new ?")
最佳答案
尝试
var attr = [NSForegroundColorAttributeName:UIColor.greenColor()]
refresher.attributedTitle = NSAttributedString(string: "hey ! is there something new ?", attributes:attr)
最新的 Swift 5.6
var attr = [NSAttributedString.Key.foregroundColor: UIColor.white]
refresher.attributedTitle = NSAttributedString(string: "hey ! is there something new ?", attributes:attr)
关于colors - 快速更改拉动以刷新文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25823063/