• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Disable Text Replacement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disable Text Replacement


  • Subject: Re: Disable Text Replacement
  • From: Andy Lee <email@hidden>
  • Date: Tue, 10 Feb 2015 21:21:19 -0500

On Feb 10, 2015, at 6:15 AM, Andreas Höschler <email@hidden> 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@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Disable Text Replacement
      • From: Andreas Höschler <email@hidden>
References: 
 >Disable Text Replacement (From: Andreas Höschler <email@hidden>)

  • Prev by Date: Re: Xcode 5.1 is crashing in 10.8.5
  • Next by Date: Re: Disable Text Replacement
  • Previous by thread: Re: Disable Text Replacement
  • Next by thread: Re: Disable Text Replacement
  • Index(es):
    • Date
    • Thread