Reputation: 771
// Make text white... and background blue
[myButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[myButton setBackgroundColor:[UIColor blueColor]];
Should that make a button with white text... and a blue background? It doesn't.
Upvotes: 4
Views: 7649
Reputation: 1052
It sounds like your button is of the UIButtonTypeRoundedRect
type. The link below should answer your question.
Is it even possible to change a UIButtons background color?
What I do however is just not give it a type.
UIButton *myButton = [[UIButton alloc] init];
[myButton setBackgroundColor:[UIColor blueColor]];
[myButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
Doesn't look quite as fancy like that though.
Upvotes: 3
Reputation: 2030
What's the buttonStyle on that button? That'll affect how the color settings make it look. You might try different button styles until you find one that looks right.
Upvotes: 0