Satyam
Satyam

Reputation: 15894

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.

Upvotes: 4

Views: 3665

Answers (2)

mclin
mclin

Reputation: 3629

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];

Upvotes: 10

Suresh Varma
Suresh Varma

Reputation: 9740

take a custom button and change its background color.

The button will be having squared corners or the other alternate is set image as background to the button. You can choose whatever you like as per your requirement.

Happy Coding...

Upvotes: 0

Related Questions