How can I create UIButton in iphone app programatically to have square corners. I don't want to have rounded corners.
Set it's buttonType to UIButtonTypeCustom so it doesn't draw the rounded rect, then give the UIButton's layer a border:
//you need this import
#import <QuartzCore/QuartzCore.h>
[button.layer setBorderColor: [[UIColor blackColor] CGColor]];
[button.layer setBorderWidth: 2.0];
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