I'm extending UIButton with generic functionality to change certain appearance attributes based on the displayed title.
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:
[self addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionNew context:nil];
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.
I do not want to just listen for clicks. Those events cause a state change, but are not the only potential causes.
Does anyone know a way to listen to and respond to state changes of a UIButton?
Thanks