When a UIButton configured with UIButtonConfiguration is selected and highlighted, my highlight colors are different in dark mode. Here's some relevant code
UIColor* kTitleColorStateNormal = [UIColor colorWithWhite:0.0 alpha:1.0];
UIColor* kTitleColorStateHighlighted = [UIColor colorWithWhite:0.0 alpha:0.3];
button.configurationUpdateHandler = ^(UIButton* incomingButton) {
UIButtonConfiguration* updatedConfig = incomingButton.configuration;
switch (incomingButton.state) {
case UIControlStateHighlighted:
updatedConfig.baseForegroundColor = kTitleColorStateHighlighted;
break;
case UIControlStateNormal:
updatedConfig.baseForegroundColor = kTitleColorStateNormal;
break;
default:
break;
}
incomingButton.configuration = updatedConfig;
};
This is the code used without UIButtonConfiguration
[button setTitleColor:kTitleColorStateNormal forState:UIControlStateNormal];
[button setTitleColor:kTitleColorStateHighlighted
forState:UIControlStateHighlighted];
and the output are these screenshots
Without UIButtonConfiguration
With UIButtonConfiguration
The white buttons are what the buttons look like in UIControlStateNormal. I agree that "with UIButtonConfiguration" does look better, but I would like the output to be the same, and it's not. Any help would be appreciated!