Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

button corner radius is not working in iOS

Tags:

ios

swift

I give button corner redius using below code but it is not wokring

button.layer.cornerRadius = 3
button.layer.borderWidth = 1

This code is not working.Please help me

like image 584
dimple Avatar asked Dec 05 '25 08:12

dimple


2 Answers

I think you need to set button property clipsToBounds true

button.clipsToBounds = true
like image 199
Donal Avatar answered Dec 06 '25 22:12

Donal


Add the following line of code before the mentioned two statements.

button.layer.masksToBounds = true
like image 34
Saurabh Bhatia Avatar answered Dec 06 '25 23:12

Saurabh Bhatia