colors - 快速更改拉动以刷新文本颜色

标签 colors swift pull-to-refresh

我有一个拉动来刷新我的应用程序。

如何更改 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/

相关文章:

javascript - 随机边框颜色 CSS

javascript - 如何计算欧氏距离? (华硕)

r - ggplot中的热图,每组不同的颜色

ios - 使用类中结构的函数

swift - 如何将 RxSwift 与 AlamoFire 和 SwiftyJSON 结合使用?

ios - 自定义 Action 控件 Swift 3.0

Android Lollipop - 拉动刷新

android - <item>-Tag 中的颜色引用,位于 <layer-list> 内

swift - 你能在 Swift 中为 UIRefreshControl 创建自定义 View 吗?

java - 在 pullToRefresh 期间在 ListView 中向下滚动时出现 IndexOutOfBound 异常