iOS UIButton添加圆角,添加边框(swift)

        var dingshibutton = UIButton.init(frame: CGRect.init(x: 75, y: 0, width: 60, height: 50))
        dingshibutton.setTitle("定时", for: .normal)
        dingshibutton.setTitleColor(UIColor.black, for: .normal)
        dingshibutton.layer.cornerRadius = 6.0;//6.0是圆角的弧度,根据需求自己更改
        dingshibutton.layer.borderColor = UIColor.blue.cgColor;//设置边框颜色
        dingshibutton.layer.borderWidth = 1.0;//设置边框宽度

 

你可能感兴趣的:(iOS UIButton添加圆角,添加边框(swift))