Skip to content

Instantly share code, notes, and snippets.

@rayh
Created May 26, 2011 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rayh/994318 to your computer and use it in GitHub Desktop.
Save rayh/994318 to your computer and use it in GitHub Desktop.
Adding KVO observation using blocks
// To add observation
self.label1Binding = [self.model addObserverForKeyPath:@"exampleValue1" block:^(NSDictionary *change) {
label1.text = [NSString stringWithFormat:@"%d", self.model.exampleValue1];
}];
// To remove observation
self.label1Binding = nil;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment