Iphone uibutton with square corners

How can I create a UIButton in an iphone application programmatically to have square corners. I do not want to have rounded corners.

+3
source share
2 answers

Set buttonType to UIButtonTypeCustom so that it doesn't draw a rounded rectangle and then gives the UIButton layer border:

//you need this import
#import <QuartzCore/QuartzCore.h>

[button.layer setBorderColor: [[UIColor blackColor] CGColor]];
[button.layer setBorderWidth: 2.0];
+10
source

take a custom button and change its background color.

The button will have a square of corners or another alternative image set as the background for the button. You can choose whatever you want, according to your requirements.

Happy coding ...

0
source

Source: https://habr.com/ru/post/1761250/