简体   繁体   English

自动更正通知

[英]Notification of autocorrect

是否有一些通知或其他方式告诉您在NSTextView或任何可编辑的元素中何时已经自动修正了某些内容?

I have in fact found out how to do this using the NSTextView spell checker delegate methods: 事实上,我已经使用NSTextView拼写检查程序委托方法了解了如何执行此操作:

- (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;
}

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

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