OOCircleRippleView.swift 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // OOCircleRippleView.swift
  3. // O2Platform
  4. //
  5. // Created by FancyLou on 2018/9/10.
  6. // Copyright © 2018 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class OOCircleRippleView: UIView {
  10. //MARK: - arguments
  11. var initSize: CGFloat = 0.5
  12. required init?(coder aDecoder: NSCoder) {
  13. fatalError("init(coder:) has not been implemented")
  14. }
  15. override init(frame: CGRect) {
  16. super.init(frame: frame)
  17. }
  18. func drawCircle() {
  19. let centerPoint = CGPoint(x: self.width/2, y: self.height/2)
  20. let beizerPath: UIBezierPath = UIBezierPath(arcCenter: centerPoint, radius: (self.frame.width * self.initSize), startAngle: 0, endAngle: CGFloat(2 * Double.pi), clockwise: true)
  21. let circlelayer = CAShapeLayer()
  22. circlelayer.fillColor = base_color.cgColor// circleColor.cgColor // 填充颜色
  23. circlelayer.strokeColor = base_color.cgColor // 边框颜色
  24. circlelayer.path = beizerPath.cgPath
  25. self.layer.addSublayer(circlelayer)
  26. }
  27. }