茅侃侃
对于Swift来说,let circle = UIView(frame: CGRectMake(0,0, 100, 100))circle.layoutIfNeeded()let centerPoint = CGPoint (x: circle.bounds.width / 2, y: circle.bounds.width / 2)let circleRadius : CGFloat = circle.bounds.width / 2 * 0.83var circlePath = UIBezierPath(arcCenter: centerPoint, radius: circleRadius, startAngle: CGFloat(-0.5 * M_PI), endAngle: CGFloat(1.5 * M_PI), clockwise: true )let progressCircle = CAShapeLayer()progressCircle.path = circlePath.CGPathprogressCircle.strokeColor = UIColor.greenColor().CGColorprogressCircle.fillColor = UIColor.clearColor().CGColorprogressCircle.lineWidth = 1.5progressCircle.strokeStart = 0progressCircle.strokeEnd = 0.22circle.layer.addSublayer(progressCircle)self.view.addSubview(circle)