Getting formatted string from NSTextView

痞子三分冷 提交于 2020-01-17 03:19:05

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!