本文介绍了自动更正通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一些通知被发布或一些其他方式来告诉什么时候在NSTextView或任何可编辑元素的东西已被自动更正?
Is there some notification that is posted or some other way to tell when in a NSTextView or any editable element that something has been autocorrected?
推荐答案
我实际上找到了如何做到这一点使用NSTextView拼写检查器委托方法:
I have in fact found out how to do this using the NSTextView spell checker delegate methods:
- (NSArray *)textView:(NSTextView *)view didCheckTextInRange:(NSRange)range types:(NSTextCheckingTypes)checkingTypes options:(NSDictionary *)options results:(NSArray *)results orthography:(NSOrthography *)orthography wordCount:(NSInteger)wordCount {
for (NSTextCheckingResult *result in results) {
if (result.resultType == NSTextCheckingTypeCorrection) {
NSLog(@"autocomplete has occured! %@", result);
}
}
return results;
}
这篇关于自动更正通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!