colorsswiftpull-to-refresh

Change pull to refresh text color with swift


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 ?")

Solution

  • 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)