Posted By

gerhardsletten on 10/18/09


Tagged

cocoa iphone


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
cnathan


Key Value Observer


 / Published in: Objective C
 

Communication between objects..

  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  

You need to login to post a comment.