2
我想在矩形的每一边的边缘创建一个小圆圈,而不是只有一个角。 我做一个标签,设置:在矩形的每一条边上创建圆形
exampleLabel.layer.borderWidth = 2.0
exampleLabel.layer.borderColor = UIColor.black.cgColor
因此,要获得这样的形状:
我想在矩形的每一边的边缘创建一个小圆圈,而不是只有一个角。 我做一个标签,设置:在矩形的每一条边上创建圆形
exampleLabel.layer.borderWidth = 2.0
exampleLabel.layer.borderColor = UIColor.black.cgColor
因此,要获得这样的形状:
还可以绘制在每个角落的圆。
let circle = UIView(frame: CGRect(x: -2.5, y: -2.5, width: 5.0, height: 5.0))
circle.layer.cornerRadius = 2.5
circle.backgroundColor = UIColor.black
self.exampleLabel.addSubview(circle)
这是一个在左上角的圆圈。你也可以为左下/右上/右下。
您可以通过x和y值的位置发挥
让我知道这是你想要的
是的,感谢ü:)我会做同样的其他3个边:P – RosS
干得好! @RosS – Gregga17