Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone uibutton with square corners

How can I create UIButton in iphone app programatically to have square corners. I don't want to have rounded corners.

like image 456
Satyam Avatar asked Dec 28 '22 08:12

Satyam


1 Answers

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];
like image 79
mclin Avatar answered Jan 13 '23 01:01

mclin