On Feb 10, 2015, at 6:15 AM, Andreas Höschler <[email protected]> wrote:
> I also found
>
> NSLog(@"isAutomaticTextReplacementEnabled %d", [NSSpellChecker
> isAutomaticTextReplacementEnabled]);
> NSLog(@"isAutomaticSpellingCorrectionEnabled %d", [NSSpellChecker
> isAutomaticSpellingCorrectionEnabled]);
>
> but no corresponding set methods!?
>
Note that you're messaging the NSSpellChecker class and not your NSTextView
instance. Those class methods on NSSpellChecker reflect system-wide settings.
For example, +isAutomaticSpellingCorrectionEnabled reflects the state of the
checkbox at System Preferences > Keyboard > Text > "Correct spelling
automatically". You can see this for yourself: go to System Preferences,
change that checkbox, run your program again, and the NSLog will print a
different value.
When a text view is created it uses your system-wide settings for spelling
correction, etc. Thereafter it is possible to change the settings for the text
view independently of the system-wide settings. To see this for yourself:
right-click a text view and look at "Spelling and Grammar". There's a "Correct
Spelling Automatically" menu item that you can toggle that affects just that
text view.
> [NSSpellChecker setAutomaticTextReplacementEnabled:NO]; <— method does
> not exist
Again, you're messaging the NSSpellChecker class rather than your NSTextView
instance. NSSpellChecker does not have a +setAutomaticTextReplacementEnabled:
class method, but NSTextView *does* have a -setAutomaticTextReplacementEnabled:
instance method. So you can do this:
[_textView setAutomaticTextReplacementEnabled:NO];
--Andy
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]