title: How to add KVO for UINavigationBar hidden/unhidden?
body: <p>I'm trying to add an observer for <code>UINavigationBar</code> hidden/unhidden like the following code, but it does not work anyway:</p>
  
  <p><code>[self.navigationController addObserver:self forKeyPath:@"navigationBarHidden" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];</code></p>
  
  <p>and also tried this,still not work:</p>
  
  <p><code>[self.navigationController.navigationBar addObserver:self forKeyPath:@"hidden" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];</code></p>
  
  <p>when I check the <code>self.navigationController.navigationBar</code> in LLDB,it told me property <code>navigationController not found for UIViewController</code> (means <code>self</code>). Does anyone have the same problem?</p>
  
  <p>addtional message:</p>
  
  <pre><code>- (void)viewDidLoad {
  [self.navigationController.navigationBar addObserver:self forKeyPath:@"hidden" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];
  </code></pre>
  
  <p>}</p>
  
  <pre><code>- (void)dealloc {
      [self.navigationController.navigationBar removeObserver:self forKeyPath:@"hidden"];
  }
  
  - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary&lt;NSString *,id&gt; *)change context:(void *)context{
      if ([keyPath isEqualToString:@"hidden"]) {
          NSLog(@"navigation bar is hidden/unhidden");
      }
  }
  </code></pre>
  
  <p>I tried for navigationBarHidden and hidden both.</p>