I am trying to use the UIButtonConfiguration to set the UI state for the button.isEnabled status. I do see the ConfigurationUpdateHandler code below being executed but when the button.isEnabled is set to false, the UI does not reflect the updated backgroundColor. Instead it is a very light gray but the foregroundColor/text is being updated. It seems that the default disabled button treatment is being used despite being set to a different color. Is there a better way to suppress the default UIButton disabled state so I can customize?
[newButton setConfigurationUpdateHandler:^(__kindof UIButton * _Nonnull button) {
UIButtonConfiguration *updatedConfiguration;
if (newButton.configuration != nil) {
updatedConfiguration = newButton.configuration;
if (button.isEnabled) {
updatedConfiguration.baseBackgroundColor = [UIColor darkGrayColor];
updatedConfiguration.baseForegroundColor = [UIColor whiteColor];
} else {
updatedConfiguration.baseBackgroundColor = [UIColor greenColor];
updatedConfiguration.baseForegroundColor = [UIColor blackColor];
}
}
button.configuration = updatedConfiguration;
}];