|
//
// CircleView.swift
// PaiAi-Guide
//
// Created by mac on 2016/12/13.
// Copyright © 2016年 mac. All rights reserved.
//
import UIKit
class CircleView: UIView {
var lineColor = UIColor(red: 0, green: 165.0/255, blue: 0, alpha: 1)
var lineWidth: CGFloat = 0.5
var pulsingCount = 4
override func draw(_ rect: CGRect) {
for i in 0...pulsingCount {
let context = UIGraphicsGetCurrentContext()
context?.setStrokeColor(lineColor.cgColor)
context?.setLineWidth(lineWidth)
let radius = (self.frame.height / 2 - borderWidth) * CGFloat(i) / CGFloat(pulsingCount)
context?.addArc(center: CGPoint(x: self.frame.width / 2, y: self.frame.height / 2), radius: radius, startAngle: 0, endAngle: 2.0 * .pi, clockwise: true)
context?.drawPath(using: .stroke)
}
}
}
|