小编Kin*_*dor的帖子

带有圆角的 UIBezierPath Star

我使用以下代码通过 UIBezierPath 创建了一个星形图像:

    let path = UIBezierPath()
    let center = CGPoint(x: rect.width / 2.0, y: rect.height / 2.0)
    let xCenter: CGFloat = center.x
    let yCenter: CGFloat = center.y
    let w = rect.width
    let r = w / 2.0
    let flip: CGFloat = -1.0 // use this to flip the figure 1.0 or -1.0
    let polySide = CGFloat(5)
    let theta = 2.0 * Double.pi * Double(2.0 / polySide)
    path.move(to: CGPoint(x: xCenter, y: r * flip + yCenter))
    for i in 1..<Int(polySide) …
Run Code Online (Sandbox Code Playgroud)

ios uibezierpath swift

1
推荐指数
1
解决办法
778
查看次数

标签 统计

ios ×1

swift ×1

uibezierpath ×1