How to change the highlighted color of a UIButton?

ios, iphone, objective-c, uibutton

Solution

Try to Override the UIButton with the following Method.. and just change the backgroud color of button when its in highlighted state.

- (void)setHighlighted:(BOOL)highlighted {
    [super setHighlighted:highlighted];

    if (highlighted) {
        self.backgroundColor = [UIColor Your Customcolor];
    }
    else{
        self.backgroundColor = [UIColor Your DefaultColor];
    }   

}

Try it..hope it helps

Problem

I created a navigation button in my UINavigationController. I set it to be highlighted when touched: ``` [someButton setShowsTouchWhenHighlighted:YES]; ``` Is there a way to change the highlighted color to something other than the default white?

Original source

Related problems