UIButton圆角和阴影

let bt =UIButton.init(frame:CGRect(x:20, y:250, width:120, height:60))

bt.backgroundColor=UIColor.orange

bt.layer.cornerRadius=10.0

bt.layer.shadowOffset=CGSize(width:1, height:1)

bt.layer.shadowOpacity=0.8

bt.layer.shadowColor=UIColor.green.cgColor

bt.setTitle("搞事情", for: .normal)

self.view.addSubview(bt)

你可能感兴趣的:(UIButton圆角和阴影)