Observing properties which are not objects
Observing properties which are not objects
- Subject: Observing properties which are not objects
- From: Andreas Grosam <email@hidden>
- Date: Tue, 28 Apr 2009 12:23:09 +0200
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?
For instance:
@interface Model {
int value;
}
@property int value;
@end
@interface Observer {
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void
*)context;
@end
// Register an observer:
Model model* = [[Model alloc] init];
Observer* observer = [[Observer alloc] init];
[model addObserver:observer forKeyPath:@"value" options:0 context:NULL];
And, btw., how can Model determine whether an observer is added to one
of its properties?
Thanks in advance
Regards
Andreas
_______________________________________________
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