TommyG TommyG - 2 months ago 60
iOS Question

How to remove UIButton selected background color?

I am looking for a solution to this problem that does NOT require using images/PNGs. I am looking for a way to remove the

's blue background color when it's in selected state, and I just cannot find a way to do that without using images. I am basically trying to do something like that in case of a

cell.selectionStyle = UITableViewCellSelectionStyleNone;


Unfortunately I'm away from my test machine at the moment, but there are two things you could try.

First would be to set the following property:

button.adjustsImageWhenHighlighted = NO;

Or uncheck "Highlight adjusts image" in Interface Builder.

If that doesn't work like you expect it to, you can deselect the button in the action you tied it to, like so:

- (IBAction)yourButtonAction:(id)sender {
    [sender setHighlighted:NO];