【发布时间】:2020-10-26 07:52:26
【问题描述】:
正如文件所说,cornerRadius 不能大于一半宽度,但在我的代码中,圆形矩形只有宽度的 1/3 变成了圆形,不知道为什么?需要帮助
文档:https://developer.apple.com/documentation/uikit/uibezierpath/1624356-init
角半径: 每个角椭圆的半径。值为 0 会生成一个没有圆角的矩形。大于矩形宽度或高度一半的值被适当地限制为宽度或高度的一半。
var path = UIBezierPath(roundedRect: CGRect(x: 50, y: 200, width: 94, height: 94), cornerRadius: 31)
path.stroke()
path = UIBezierPath(roundedRect: CGRect(x: 50, y: 300, width: 94, height: 94), cornerRadius: 30.5)
path.stroke()
path = UIBezierPath(roundedRect: CGRect(x: 50, y: 400, width: 94, height: 94), cornerRadius: 31.5)
path.stroke()
【问题讨论】:
标签: swift core-graphics quartz-2d