Re: NSTextView, spell checking and temporary attributes
Re: NSTextView, spell checking and temporary attributes
- Subject: Re: NSTextView, spell checking and temporary attributes
- From: Seth Willits <email@hidden>
- Date: Mon, 02 Jan 2012 11:07:01 -0800
On Jan 2, 2012, at 10:20 AM, Martin Hewitson wrote:
> [[self layoutManager] removeTemporaryAttribute:NSBackgroundColorAttributeName forCharacterRange:visibleRange];
>
> This has the unfortunate side-effect of removing the red squiggly lines which indicate misspelled words.
Hmm. Works fine here.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[textView setString:@"Hello this is a reallly good day to be alive."];
[[textView layoutManager] addTemporaryAttribute:NSBackgroundColorAttributeName value:[NSColor yellowColor] forCharacterRange:NSMakeRange(6, 4)];
[[textView layoutManager] addTemporaryAttribute:NSBackgroundColorAttributeName value:[NSColor yellowColor] forCharacterRange:NSMakeRange(16, 7)];
[textView checkTextInDocument:nil];
}
- (IBAction)action:(id)sender;
{
[[textView layoutManager] removeTemporaryAttribute:NSBackgroundColorAttributeName forCharacterRange:NSMakeRange(0, textView.string.length)];
}
--
Seth Willits_______________________________________________
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