On 28/04/2009, at 8:23 PM, Andreas Grosam wrote:
Maybe I miss something, but it seems, the standard KVO does not work
for properties whose values are non-objects, say int, float etc.
How can I effortless accomplish to observe at such properties?
Scalar properties (int, float, etc) are automatically wrapped in a
NSValue/NSNumber instance when using KVC and KVO.
And, btw., how can Model determine whether an observer is added to
one of its properties?
In general, it can't. And in general, it doesn't need to know. If you
follow the rules you shouldn't need to know. It does take a little bit
of grokking at first, because when I first approached KVO that was my
first question to myself also. Hence my first design sucked. Later, I
realised that a good design doesn't require this knowledge things got
a whole lot easier, particularly when de-observing (if that's the
right term).
--Graham
_______________________________________________
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