• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Observing properties which are not objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Observing properties which are not objects
      • From: Graham Cox <email@hidden>
  • Prev by Date: Binding question
  • Next by Date: Re: Dividing NSView to subviews
  • Previous by thread: Re: Binding question
  • Next by thread: Re: Observing properties which are not objects
  • Index(es):
    • Date
    • Thread