title: How listen for UIButton state change?
body: <p>I'm extending <code>UIButton</code> with generic functionality to change certain appearance attributes based on the displayed title.</p>
  
  <p>In order to do this, I need to detect and respond to changes in the "state" property.  This is so I make sure the appearance is adjusted properly if the user has set different titles for different states.  I assumed I would need to use some sort of KVO like the following:</p>
  
  <pre><code>[self addObserver:self 
         forKeyPath:@"state" 
            options:NSKeyValueObservingOptionNew 
            context:nil];
  </code></pre>
  
  <p>But this does not seem to fire the observeValueForKeyPath:... method for @"state" or @"currentTitle".  I assume this is because UIButton does not implement the KVO pattern for those properties.</p>
  
  <p>I do not want to just listen for clicks.  Those events cause a state change, but are not the only potential causes.</p>
  
  <p>Does anyone know a way to listen to and respond to state changes of a UIButton?</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <h2><strong>UPDATE</strong></h2>
  
  <p>Just a note since I've learned a few things in the last couple years ;).</p>
  
  <p>I've since talked with some Apple folks who know, and the reason KVO doesn't work on the state property owes to the fact that <strong>NONE</strong> of UIKit is guaranteed to be KVO compliant.  Thought that was worth repeating here--if you are trying to listen to <em>any</em> property of a UIKit framework class, be aware that it may work but is not officially supported and could break on different iOS versions.</p>