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
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
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];
Valid only for iOS
Yes, set attributed text, then select the text, right mouse click > Font > Underline
attributedString
property would have been reflected in Interface Builder like they do with the other controls... –
Scarface 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];
© 2022 - 2024 — McMap. All rights reserved.