Created
May 26, 2011 23:10
-
-
Save rayh/994318 to your computer and use it in GitHub Desktop.
Adding KVO observation using blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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