How to round the corners of a button

前端 未结 15 695
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 06:54

I have a rectangle image (jpg) and want to use it to fill the background of a button with rounded corner in xcode.

I wrote the following:

UIButton *b         


        
15条回答
  •  时光说笑
    2020-12-07 07:37

    Pushing to the limits corner radius up to get a circle:

        self.btnFoldButton.layer.cornerRadius = self.btnFoldButton.frame.height/2.0;
    

    If button frame is an square it does not matter frame.height or frame.width. Otherwise use the largest of both ones.

提交回复
热议问题