5

I'm trying to underline a UIBarButtonItem, but the following has no effect:

testBarItem.setTitleTextAttributes([
    NSUnderlineStyleAttributeName:NSUnderlineStyle.StyleDouble.rawValue      
        ], forState: .Normal)

Changing other properties such as NSForegroundColorAttributeName does work.

The same code above used with an NSAttributedString and a UILabel does underline the text, so why does this not work with a UIBarButtonItem?

sudo make install
  • 5,629
  • 3
  • 36
  • 48
Mark
  • 6,647
  • 1
  • 45
  • 88
  • I can reproduce this in iOS 9/Xcode 7. I tried setting the style to `.StyleNone` first (as in [this question](http://stackoverflow.com/questions/26136157/underline-part-of-a-string-using-nsmutableattributedstring-in-ios8-is-not-workin)), but that didn't help unfortunately. – sudo make install Aug 23 '15 at 14:11

0 Answers0