aneuryzm
aneuryzm

Reputation: 64834

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

Upvotes: 10

Views: 7953

Answers (2)

DeFrenZ
DeFrenZ

Reputation: 2252

Valid only for iOS

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

enter image description here

Upvotes: 29

Francis McGrew
Francis McGrew

Reputation: 7272

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];

Upvotes: 18

Related Questions