Turn off OS X 10.7 Lion's “auto-correct” feature programmatically?

前端 未结 2 1299
感动是毒
感动是毒 2021-01-26 23:05

OS X Lion has an iPhone-like autocorrect feature as you\'re typing.

This feature interferes with my typing app. The people using my app would not want it turned on a

相关标签:
2条回答
  • 2021-01-26 23:35

    Is this in an NSTextView? If so, there are several methods available to alter the correction behavior:

    - (void)setAutomaticSpellingCorrectionEnabled:(BOOL)flag
    - (void)setAutomaticTextReplacementEnabled:(BOOL)flag
    

    Please try those, they should be what you are looking for.

    0 讨论(0)
  • 2021-01-26 23:44

    Finally, there is additional API to support the new global user preference settings for automatic text replacement and spelling correction. NSTextView now by default will keep track of and follow these settings automatically, but applications using NSTextView can override that by programmatically using existing NSTextView methods such as -setAutomaticTextReplacementEnabled: and -setAutomaticSpellingCorrectionEnabled: to control an individual text view's settings. The new API is primarily for non-text view clients who wish to keep track of the settings for themselves, using the NSSpellChecker class methods to determine their values, and optionally also notifications to determine when the settings have changed.

    + (BOOL)isAutomaticTextReplacementEnabled;
    + (BOOL)isAutomaticSpellingCorrectionEnabled;
    
    NSString * const NSSpellCheckerDidChangeAutomaticSpellingCorrectionNotification;
    NSString * const NSSpellCheckerDidChangeAutomaticTextReplacementNotification;
    

    https://developer.apple.com/library/mac/#releasenotes/Cocoa/AppKit.html

    0 讨论(0)
提交回复
热议问题