Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIButton is partially red when enabling Show Blended Layers

I would like to improve performance by making my views opaque where appropriate. I have a UIButton that is showing red in the simulator - it's only red around the text of the button, not the entire frame. In the Storyboard, I've enabled Opaque and changed the background color from clear to white, yet it still shows red in the simulator.

How do I change that to green so that it's fully opaque and not trying to work with transparency?

Note that UILabels are fully green when you change its background and opaque to YES.

like image 597
Jordan H Avatar asked May 29 '14 18:05

Jordan H


1 Answers

I am use following code in your case:

[button.titleLabel setOpaque:YES];
[button.titleLabel setBackgroundColor:[UIColor whiteColor]]; 
// or which-you-want-color

Obviously, you should keep weak reference to your button.

Pretty works. Button size smaller than the screenshot size.

enter image description here

like image 183
Oleg Sobolev Avatar answered Oct 22 '22 23:10

Oleg Sobolev