开发者

Insert a string of text into an NSTextView at the cursor position or selection of text using Objective C

How开发者_如何学编程 would I do this using Objective C and cocoa using Xcode? I am trying to insert a string at the cursor or user selection on the click of a button.


NSTextView has a method -insertText: which does what you want:

[myTextView insertText:@"hello world"];

The method accepts either an NSString or an NSAttributedString.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜