Key Value Observer


/ Published in: Objective C
Save to your folder(s)

Communication between objects..


Copy this code and paste it in your HTML
  1. - (void)applicationDidFinishLaunching:(UIApplication *)application {
  2.  
  3. // Override point for customization after app launch
  4. [window addSubview:viewController.view];
  5. [viewController addObserver:self forKeyPath:@"iVar" options:(NSKeyValueObservingOptionNew) context:NULL];
  6. [window makeKeyAndVisible];
  7. }
  8.  
  9. - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
  10. change:(NSDictionary *)change context:(void *)context {
  11. NSLog(@"Value %@ changed in %@", keyPath, [object description]);
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.