利用stroke和Path动画制作下拉刷新动画。
首先创建一个虚线圆。
let ovalShapeLayer = CAShapeLayer()
ovalShapeLayer.strokeColor = UIColor.white.cgColor//指定path的渲染颜色
ovalShapeLayer.fillColor = UIColor.clear.cgColor//指定圆填充色
ovalShapeLayer.lineWidth = 4.0//线宽
ovalShapeLayer.lineDashPattern = [2, 3]//实线长度2,间隙长度3
let refreshRadius = frame.size.height/2 * 0.8
ovalShapeLayer.path = UIBezierPath(ovalIn: CGRect(
x: frame.size.width/2 - refreshRadius,
y: frame.size.height