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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to