Re: Core data commit changes made programmatically

2013-04-24 Thread Peng Gu
I found the solution. Just do [theTextView didChangeText] in the end of the changes. Thanks - Peng On Wed, Apr 24, 2013 at 2:08 PM, Kyle Sluder wrote: > Mutating an attributed string doesn't count as "key-value coding", even if > the string itself is exposed as a KVC-compliant property. > > S

Re: Core data commit changes made programmatically

2013-04-24 Thread Kyle Sluder
Mutating an attributed string doesn't count as "key-value coding", even if the string itself is exposed as a KVC-compliant property. Since the only KVC-compliant change for the textStorage property would be to change it to a completely new object instance, and that would be very wasteful, you w

Re: Core data commit changes made programmatically

2013-04-24 Thread Jerry Krinock
On 2013 Apr 23, at 14:41, Peng Gu wrote: Peng, I don't quite understand all of what you're doing there, but from this remark, > 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 ch

Core data commit changes made programmatically

2013-04-23 Thread Peng Gu
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 c