On May 21, 2009, at 11:33 AM, Morales Vivó Óscar wrote:

I have an cocoa controller object with a property that is actually read from another, C++ object. It works fine when updating or reading the value, but sometimes other C++ parts of the program will change the value of the property and there's no good way to notify the cocoa controller object of the change.

I wanted to know if it's an issue from, elsewhere in the program, just call the object's willChangeValueForKey: and didChangeValueForKey: for a property that automatically notifies when directly changed, or if there's a more immediate and officially sanctioned way of letting an object know that it should notify its observers that one of its properties has changed its value.

Sorry if this is a silly question, but...

If you are able to call the associated KVO methods (willChangeValueForKey:, didChangeValueForKey:), why can't you just call the property setter?

I understand that if you've got data changing only within the C++, propagating that back to the Obj-C object requires extra work. But if you know when to call the KVO methods, surely you're already propagating it somehow. Seems like you could at that point just use the Obj-C object's setter instead of setting it internally to the C++ and calling the KVO methods directly.

Pete_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to