I have a UIButton subclass that does not use a UIImage background, just a background color. One thing i've noticed is that when you set a button's background image, there is a default highlighted state where the button would turn slightly darker when pressed.
Here is my current code.
- (void)awakeFromNib
{
[super awakeFromNib];
self.backgroundColor = [UIColor whiteColor];
self.layer.cornerRadius = 4;
[self.titleLabel setFont:[UIFont systemFontOfSize:15]];
[self setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
}
With this code,I am not given that default selection state if i only set the background color. I've tried overriding this with - (void)setHighlighted:(BOOL)highlighted
and setting the darker color of the button, but either I am not getting the color right or theres more to just setting the color.
I'm unsure of how i can mimic that selection state. Any help would be appreciated!