gpt4 book ai didi

ios - 在矩形的每条边上创建圆

转载 作者:可可西里 更新时间:2023-11-01 02:04:24 25 4
gpt4 key购买 nike

我想在矩形的每一边的边缘上创建一个小圆圈,而不仅仅是一个角。我制作了一个标签:

 exampleLabel.layer.borderWidth = 2.0

exampleLabel.layer.borderColor = UIColor.black.cgColor

enter image descriptiond here

所以要得到像这样的形状:

enter image description here

最佳答案

你也可以在每个角上画一个圆。

    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 值来调整位置

如果这是你想要的,请告诉我

关于ios - 在矩形的每条边上创建圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44324913/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com