set cornerRadius and setbackgroundimage to UIButton

后端 未结 7 1103

I am trying to set cornerRadius of UIButton but I dont know how to do it.

If I do like this:

button.layer.cornerRadius = 5;

works w

7条回答
  •  孤独总比滥情好
    2020-12-23 19:56

    btn.clipsToBounds = YES; 
    

    i Just added this and it worked for me. I was actually able to set corner radius to UIButton with setting an image to that particular UIButton.

提交回复
热议问题