I have the following code for a custom UIButton:
btnLogin.layer.cornerRadius = 10;
[btnLogin setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bluetint.png"]]];
[btnLogin setAlpha:1];
[btnLogin setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btnLogin setBackgroundImage:[UIImage imageNamed:@"reallybluetint.png"] forState:UIControlStateHighlighted];
[btnLogin setBackgroundImage:[UIImage imageNamed:@"reallybluetint.png"] forState:UIControlStateSelected];
When I highlight the button it becomes squared even though it has rounded corners in the Normal state.
Any ideas?
Try with this code it will work,
btnLogin.layer.cornerRadius = 10.0;
[btnLogin setClipsToBounds:YES];
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