I tried use a transparent png as a background, but not success. How can I solve it ? thz.
Changing the Type to Custom in the Inspector window (Interface builder) worked for me.
To create a transparent button (without using an image):
- (void)viewDidLoad
{
[super viewDidLoad];
CALayer *layer = <your button>.layer;
layer.backgroundColor = [[UIColor clearColor] CGColor];
layer.borderColor = [[UIColor darkGrayColor] CGColor];
layer.cornerRadius = 8.0f;
layer.borderWidth = 1.0f;
}
This is a good one too:
[button.layer setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.5].CGColor];
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