[SOLVED} Re: Can an object observe itself?
[SOLVED} Re: Can an object observe itself?
- Subject: [SOLVED} Re: Can an object observe itself?
- From: Stuart Malin <email@hidden>
- Date: Sat, 7 Mar 2009 10:53:20 -1000
Oops, found my problem... the model class is NSCoding compliant and so
objects can also be initialized via -initWithCoder, and I needed to
add the observer there as well.
On Mar 7, 2009, at 10:31 AM, Stuart Malin wrote:
I have a model class with multiple properties. I need to know in a
variety of places when certain of these change. Presently, the model
objects can be changed by an inspector that has bindings to the
model instances, which are managed as a collection by an
NSArrayController. So... I tried adding code to the model object to
observe itself (on a key that is a dependent key set up with
+setKeys:triggerChangeNitificationsForDependentKeys). I was then
going to have that observer issue a notification. However, the
model's -observeValueForKeyPath:ofObject:change:context: method
isn't getting called when I make changes. Thinking the problem was
with the dependent key, I changed to observe a specific key. That
doesn't work either. So I am wondering if an object can observe
itself. I add the observer in the model object's -init method,
after invoking -init on the superclass:
<snip>
_______________________________________________
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