公司网站维护一年多少钱,wordpress主题layui,网址建设,oa软件定制开发我想要的是一个自定义UIButton#xff0c;它有一个渐变边框(只是边框是渐变)和圆角 . 我几乎到了我想去的地方#xff0c;但是角落有问题 . 这是我目前拥有的#xff1a;这是我的代码#xff1a;override func viewDidLoad() {super.viewDidLoad()let gradient CAGradient…我想要的是一个自定义UIButton它有一个渐变边框(只是边框是渐变)和圆角 . 我几乎到了我想去的地方但是角落有问题 . 这是我目前拥有的这是我的代码override func viewDidLoad() {super.viewDidLoad()let gradient CAGradientLayer()gradient.frame CGRect(origin: CGPoint.zero, size: self.myButton.frame.size)gradient.colors [UIColor.blue.cgColor, UIColor.green.cgColor]gradient.startPoint CGPoint(x: 0.0, y: 0.5)gradient.endPoint CGPoint(x: 1.0, y: 0.5)gradient.cornerRadius 15let shape CAShapeLayer()shape.lineWidth 5shape.path UIBezierPath(rect: self.myButton.bounds).cgPathshape.strokeColor UIColor.black.cgColorshape.fillColor UIColor.clear.cgColorshape.cornerRadius 15gradient.mask shapeself.myButton.clipsToBounds trueself.myButton.layer.cornerRadius 15self.myButton.layer.addSublayer(gradient)}所以问题是我如何用渐变显示角落