Re: NSMutableAttributedString binding
Re: NSMutableAttributedString binding
- Subject: Re: NSMutableAttributedString binding
- From: Jonathan Dann <email@hidden>
- Date: Thu, 10 Jan 2008 18:23:03 +0000
I have binded the a NSTextView to an NSAttributedString. This works
fine when I set the binded variable, the NSTextView is showing the
text fine.
But if I make a change in the variable, this is not reflected in the
NSTextView.
I am doing this:
[[self attributedText] replaceCharactersInRange:elementRange
withString:[te c]];
and the NSTextView which is binded to attributedText does never show
the change.
If I do an NSLog of this variable immediately following the above
line, I can see the change.
What should I do to get the NSTextView to show the change?
Even though your text view is bound to the NSMutableAttributedString,
I'm not sure that the method you give is KVO-compliant.
You may need [self setAttributedText:[[self attributedText]
replaceCharactersInRange:elementRangeWithString:[te c]]];
This is what the binding mechanism is looking for so it knows to
update your field, you have to update our model programmatically with
a setter or another KVO-compliant method.
As always, tell me if I'm wrong!
Jonathan
_______________________________________________
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