3

I have a pull to refresh in my app.

How do i change the text color of the attributedTitle ?

 refresher.attributedTitle = NSAttributedString(string: "hey ! is there something new ?")
jmcastel
  • 1,365
  • 7
  • 17
  • 34

1 Answers1

11

Try

var attr = [NSForegroundColorAttributeName:UIColor.greenColor()]
refresher.attributedTitle = NSAttributedString(string: "hey ! is there something new ?", attributes:attr)

Latest Swift 5.6

var attr = [NSAttributedString.Key.foregroundColor: UIColor.white]
refresher.attributedTitle = NSAttributedString(string: "hey ! is there something new ?", attributes:attr)
Sunil Targe
  • 7,251
  • 5
  • 49
  • 80
chasew
  • 8,438
  • 7
  • 41
  • 48