title: Simple KVO example
body: <p>I am trying to do simple KVO example, but I am having problems.   </p>
  
  <p>This is my *.m file:</p>
  
  <pre><code>#import "KVO_ViewController.h"
  
  @interface KVO_ViewController ()
  
  @property NSUInteger number;
  
  @end
  
  @implementation KVO_ViewController
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
  
      [self addObserver:self forKeyPath:@"number" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  - (IBAction)incNumber:(id)sender
  {
      _number++;
      NSLog(@"%d", _number);
  }
  
  -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
  {
      NSLog(@"From KVO");
  
      if([keyPath isEqualToString:@"number"])
      {
          id oldC = [change objectForKey:NSKeyValueChangeOldKey];
          id newC = [change objectForKey:NSKeyValueChangeNewKey];
  
          NSLog(@"%@ %@", oldC, newC);
      }
  }
  
  @end
  </code></pre>
  
  <p><strong>Note:</strong> I have a button which when clicked it will increment the <code>number</code> property.<br>
  I want to be notified when <code>number</code> property is changed.    </p>
  
  <p>The code is not working and I can not figure it why.    </p>