Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I underline the text of a NSTextField from interface builder?

Can I underline the text of a NSTextField from interface builder ?

So far, I've only able to change its color. Is there a way to underline it ?

thanks

like image 392
aneuryzm Avatar asked Feb 10 '12 16:02

aneuryzm


2 Answers

No, you'd have to do it in code. For example:

NSMutableAttributedString *str = [[myTextField attributedStringValue] mutableCopy];

[str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(0, str.length)];

[myTextField setAttributedStringValue:str];

[str release];
like image 72
Francis McGrew Avatar answered Oct 26 '22 22:10

Francis McGrew


Valid only for iOS

Yes, set attributed text, then select the text, right mouse click > Font > Underline

enter image description here

like image 24
DeFrenZ Avatar answered Oct 26 '22 21:10

DeFrenZ