<error>:CGPathAddLineToPoint:没有当前点

时间:2017-03-24 08:51:30

标签: ios swift

func drawMyShape(centerPoint: CGPoint, radius:CGFloat, array: Array<Double>, path: UIBezierPath, index: Int) {

    if index == 0 {
        path.move(to: CGPoint(x: Double(centerPoint.x) +  array[0] * Double(radius), y: Double(centerPoint.y)))
    } else {
        let point = CGPoint(x: Double(centerPoint.x) + array[index] * Double(radius) * cos(2*M_PI*Double(index)/Double(array.count)), y: Double(centerPoint.y) + array[index] * Double(radius) * sin(2*M_PI*Double(index)/Double(array.count)))
        path.addLine(to: point)
    }

    if index == array.count {
        path.close()
    }
}

跑步时没有当前点警告。如何获得当前点。 THX。

0 个答案:

没有答案