问题
I am creating an OSX app with NSTextView
inside NSScrollView
. Using the FormatMenuItem
I can modify the text in that NSTextView
to Bold, italic etc. But when I get the values using (NSTextViewOutlet.String)
I cannot get the modified string, that is the string contain bold and italic characters.
回答1:
By using below code solve my problem.and i use NSTextField instead of NSTextView.
let str = txt_outlet.attributedStringValue
来源:https://stackoverflow.com/questions/40358955/getting-formatted-string-from-nstextview