Code Monkey Code Monkey - 1 year ago 93
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download