So I have some UIButtons. They're blue when enabled, and gray when disabled, as I expect.
If I go from my front page to Current Contests and there's a network error like this:
I call [self.navigationController popViewControllerAnimated:YES];
to get back to the main page, and I get this on iOS 7, iPhone 4:
Gray buttons, but they work. So I know they're not disabled. This does not happen on iOS 8, iPad Mini.
You can fix this using the tintAdjustmentMode
property, introduced in iOS 7:
When this property’s value is UIViewTintAdjustmentModeDimmed, the value of the tintColor property is modified to provide a dimmed appearance.
If the system cannot find a non-default value in the subview hierarchy when you query this property, the value is UIViewTintAdjustmentModeNormal.
When this property’s value changes (either by the view’s value changing or by one of its superview’s values changing), -the system calls the tintColorDidChange method to allow the view to refresh its rendering.
- from the UIView Class Reference.
When certain overlay views such as UIAlertView
, etc., become visible, they essentially change this property to UIViewTintAdjustmentModeDimmed
. You can fix this by setting the tintAdjustmentMode
for the entire UIWindow
(and therefore subview hierarchy) with:
self.window.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;