NSTextView 的 insertText 方法在 OS X v10.11 中已弃用.什么是替代品? [英] NSTextView's insertText method is deprecated in OS X v10.11. What is the replacement?
问题描述
我在 AppKit API 参考中看到 insertText
方法在 OS X v10.11 中已被弃用.我应该用什么来代替?
文档说
<块引用>- (void)insertText:(id)aString
此方法是用户键入的文本输入NSTextView
的方法.有关详细信息,请参阅 NSInputManager
类和 NSTextInput
协议规范....
在NSTextInput
中有一个注释:
重要
NSTextInput
协议将被弃用.请使用 NSTextInputClient
协议,在 OS X v10.5 中引入,如NSTextInputClient 协议参考
中所述.
在NSTextInputClient
协议中有一个方法
- (void)insertText:(id)aString替换范围:(NSRange)替换范围
这似乎是合适的替代品
I saw in the AppKit API Reference that the insertText
method is deprecated in OS X v10.11. What am I supposed to use as a replacement?
The documentation says
- (void)insertText:(id)aString
This method is the means by which text typed by the user enters an
NSTextView
. See theNSInputManager
class andNSTextInput
protocol specifications for more information. ...
In NSTextInput
there is a note:
IMPORTANT
NSTextInput
protocol is slated for deprecation. Please useNSTextInputClient
protocol, introduced in OS X v10.5, as described inNSTextInputClient Protocol Reference
.
In NSTextInputClient
protocol there is a method
- (void)insertText:(id)aString
replacementRange:(NSRange)replacementRange
This seems to be the appropriate replacement
这篇关于NSTextView 的 insertText 方法在 OS X v10.11 中已弃用.什么是替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!