Re: Explanation needed regarding dependent keys
Re: Explanation needed regarding dependent keys
- Subject: Re: Explanation needed regarding dependent keys
- From: Scott Stevenson <email@hidden>
- Date: Sat, 28 Jul 2007 15:28:35 -0700
On Jul 28, 2007, at 2:55 PM, Michael Norris wrote:
Can anyone explain to me why it only updates the NSTextView *if* I
go through the hoop of releasing the "text"object, instead of just
doing mutating it? Is this documented somewhere? Why does the
NSTextView care whether my ivar has been released or not? Doesn't
setKeys: triggerChangeNotificationsForDependentKey: ensure that the
NSTextView will reload its attributedString key?
Admittedly, I haven't tried this exact thing you're doing, but my
guess is the KVO implementation is not going to examine the contents
of the string to decide if it has changed. Instead, it will look see
if the pointer value (that is, the object itself) has changed.
Again, that's just a guess without building a test project. Someone
else may be able to offer a better answer.
There are some other things you should change in the code. You might
want to consider doing a "copy" rather than "retain" on mutable
strings, since it's the value you care about.
- Scott
_______________________________________________
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