Is there any approach how to create from some color (let's say it's [UIColor redColor]) the default highlighted shade of this color (some kind of dark red color in this case).
In my case, I have a UIButton (inside of UIBarButton) and I would like to setup the titleColor for UIControlStateHighlighted state just the same as the default hightlighted color of the UIImage. See the code below:
UIColor *color = [UIColor redColor];
UIColor *highlightedColor = ???;
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[[UIImage imageNamed:@"back-arrow"] imageWithOverlayColor:color] forState:UIControlStateNormal];
[button setImage:[[UIImage imageNamed:@"back-arrow"] imageWithOverlayColor:highlightedColor] forState:UIControlStateHighlighted];
[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:color forState:UIControlStateNormal];
[button setTitleColor:highlightedColor forState:UIControlStateHighlighted];
button.imageEdgeInsets = UIEdgeInsetsMake(0.f, -5.f, 0.f, 0.f);
If I don't setup the image/title for the UIControlStateHighlighted state, only the image is highlighted when button is pressed:
