Какао NSButton с подчеркнутым названием - PullRequest
0 голосов
/ 08 октября 2019

Я пытаюсь создать NSButton с подчеркнутым заголовком.

@IBOutlet var myButton: NSButton!
let underlineAttribute = [NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single]
let underlineAttributedString = NSAttributedString(string: "Button Title", attributes: underlineAttribute)
myButton.attributedTitle = underlineAttributedString

Но я получаю ошибку:

<NSATSTypesetter: 0x600003719500>: Exception -[__SwiftValue _getValue:forType:]: unrecognized selector sent to instance 0x600000ca4060 raised during typesetting layout manager <NSLayoutManager: 0x100e1a140>
    1 containers, text backing has 5 characters
    selected character range {0, 0} affinity: upstream granularity: character
    marked character range {0, 0}
    Currently holding 5 glyphs.
    Glyph tree contents:  5 characters, 5 glyphs, 1 nodes, 64 node bytes, 256 storage bytes, 320 total bytes, 64.00 bytes per character, 64.00 bytes per glyph
    Layout tree contents:  5 characters, 5 glyphs, 0 laid glyphs, 0 laid line fragments, 1 nodes, 64 node bytes, 0 storage bytes, 64 total bytes, 12.80 bytes per character, 12.80 bytes per glyph, 0.00 laid glyphs per laid line fragment, 0.00 bytes per laid line fragment
, glyph range {0 5}. Ignoring...

Можно ли вообще создать подчеркнутый заголовок?

Спасибо!

...