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 UILabel
s are fully green when you change its background and opaque to YES.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With