检查是否已编辑NSTextView

检查是否已编辑NSTextView

本文介绍了检查是否已编辑NSTextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有办法在NSTextView被修改时收到通知?在NSTextField中,我只是设置了默认发送操作的目标并且工作正常,但我没有在NSTextView上看到任何已发送的操作。

Is there a way to get notified when a NSTextView gets modified?. In a NSTextField I just set the target for the default sent action and works perfectly, but I don't see any sent actions on a NSTextView.

推荐答案

加油吧。轮询? 真的吗?
NSTextView继承自NSText,符合NSTextDelegate协议。在文档中查找。您正在寻找的方法是: - (void)textDidChange:(NSNotification *)aNotification 您可以在TextView的委托中实现,也可以通过注册NSTextDidChangeNotification来获取通知。

Come on guys. Polling? Really?NSTextView inherits from NSText, which conforms to the NSTextDelegate protocol. Look it up in the docs. The method you are looking for is: - (void)textDidChange:(NSNotification *)aNotification which you can either implement in your TextView's delegate or get by registering for a "NSTextDidChangeNotification" notification.

这篇关于检查是否已编辑NSTextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 16:50