I have a textview that is binding to Core data, I want to be able to highlight the selected text in the textview.
*[self.textStorage addAttribute:NSBackgroundColorAttributeName value:[ NSColor yellowColor] range:self.selectedRange];* The code above works, but core data won't save the attributes changes unless I type some words in the Textview. Calling moc to commit editting doesn't save the changes too. *[aManagedObjectContext commitEditing];* *[aManagedObjectContext save:&error];* I also tried to set the value of the object in Core data after adding the attributes, but *[aManagedObject setValue:text forKey:@"text"] *will make the textview lose focus. Is there any way to force the core data to save the changes immediately? Or any better way to highlight selected text in NSTextview, like addFontTrait: used by Bold, Italic Menu Items? Thanks, - Peng * * _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com