RGriffiths
RGriffiths

Reputation: 5970

Stop UIButton turning blue when pressed

In my iPad app I have a UIButton that when pressed initiates some data transfer which takes time. During this time the button turns blue as shown:

enter image description here

Is there anyway of changing this colour?

Upvotes: 1

Views: 217

Answers (2)

Kirsteins
Kirsteins

Reputation: 27345

Change the tint color, it will be used when button is highlighted.

[myButton setTintColor:[UIColor blackColor]];

Upvotes: 3

Bhavesh Nayi
Bhavesh Nayi

Reputation: 3656

Try This

UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, 50, 100, 50)];
    [button setTitle:@"hi" forState:UIControlStateNormal];
    [button setBackgroundColor:[UIColor blackColor]];
    [self.view addSubview:button];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:5.0];
    button.backgroundColor = [UIColor whiteColor];
    [UIView commitAnimations];

Upvotes: 0

Related Questions