简体   繁体   English

将文本文件复制到NSTextView

[英]Copying text files to NSTextView

I need to get text from text files and put it in a non-editable NSTextView. 我需要从文本文件中获取文本并将其放在不可编辑的NSTextView中。 How can I accomplish this? 我怎么能做到这一点?

  1. Load the file into an NSString . 将文件加载到NSString中
  2. Set the NSTextView's string to the loaded string (hint: NSTextView is a subclass of NSText ). 设置NSTextView的字符串加载的字符串(提示:NSTextView是的子类NSText )。
  3. Ship BetterTextEditor.app and profit. 发货BetterTextEditor.app并获利。

Prerequisite: Look up the needed methods in the two API reference documents I linked in the steps above. 先决条件:在上面的步骤中链接的两个API参考文档中查找所需的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM