Mike Flynn
Mike Flynn

Reputation: 24315

Set Background Color Globally On On UIButtons

What is the best to change globally all UIButtons background color? I already set the tint globally

[[UIApplication sharedApplication] delegate].window.tintColor =

Upvotes: 2

Views: 464

Answers (2)

Aaron Brager
Aaron Brager

Reputation: 66234

[[UIButton appearance] setBackgroundImage:[UIImage imageNamed:@"button.png"]
                            forState:UIControlStateNormal];

Or

[[UIButton appearance] setBackgroundColor:[UIColor purpleColor]];

Here's some more info on the appearance proxy: http://developer.apple.com/library/ios/documentation/uikit/reference/UIAppearance_Protocol/Reference/Reference.html

Upvotes: 4

iOS Dev
iOS Dev

Reputation: 4248

Check this out:

[[UIButton appearance] setBackgroundColor:[UIColor redColor]];

Upvotes: 0

Related Questions