// 按钮基本理解
//CG:计算机图形
let rect = CGRect(x: 0, y: 0, width: 300, height: 100)
let rectButton = UILabel(frame: rect)
rectButton.text = "立即订购"
rectButton.textColor = UIColor.white
rectButton.backgroundColor = UIColor.systemPink
//Alignment校准
rectButton.textAlignment = .center
//layer是层,corner角,radius半径
rectButton.layer.cornerRadius = 20
//clipsToBounds 是否裁边
rectButton.clipsToBounds = true```
![](https://www.icode9.com/i/l/?n=20&i=blog/1872387/202010/1872387-20201026172636094-129278213.png)
![](https://www.icode9.com/i/l/?n=20&i=blog/1872387/202010/1872387-20201026172643198-859996645.png)