Code Monkey Code Monkey - 6 months ago 33
iOS Question

How to change the highlighted color of a UIButton?

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?


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];


Try it..hope it helps