PPFMultiplePercentCircleView

2020-04-22  本文已影响0人  轻云绿原

PPFMultiplePercentCircleView

效果

multiple percent circles

引用

GitHub

pod 'PPFMultiplePercentCircleView'

怎么用

initialize

1.initialize circles that are displayed in PPFMultiplePercentCircleView

        let list = [
            PPFMultiplePercentCircleView.Circle(lineForegroundColor: randomColor(), lineBackgroundColor: randomColor(), lineWidth: 10, linePercent: 0.30),
            PPFMultiplePercentCircleView.Circle(lineForegroundColor: randomColor(), lineBackgroundColor: randomColor(), lineWidth: 10, linePercent: 0.10),
            PPFMultiplePercentCircleView.Circle(lineForegroundColor: randomColor(), lineBackgroundColor: randomColor(), lineWidth: 10, linePercent: 0.08),
            PPFMultiplePercentCircleView.Circle(lineForegroundColor: randomColor(), lineBackgroundColor: randomColor(), lineWidth: 10, linePercent: 1),
            PPFMultiplePercentCircleView.Circle(lineForegroundColor: randomColor(), lineBackgroundColor: randomColor(), lineWidth: 10, linePercent: 0.30),
            PPFMultiplePercentCircleView.Circle(lineForegroundColor: randomColor(), lineBackgroundColor: randomColor(), lineWidth: 10, linePercent: 0.50),
            PPFMultiplePercentCircleView.Circle(lineForegroundColor: randomColor(), lineBackgroundColor: randomColor(), lineWidth: 10, linePercent: 0.78),
            PPFMultiplePercentCircleView.Circle(lineForegroundColor: randomColor(), lineBackgroundColor: randomColor(), lineWidth: 10, linePercent: 0),
        ]

2.initialize

        let v = PPFMultiplePercentCircleView(circles: [], holeRadius: 20, lineSpace: 1)
        v.backgroundColor = UIColor.white
        v.clipsToBounds = true
        v.frame = CGRect(x: view.bounds.width / 2 - 150, y: 100, width: 300, height: 300)
        view.addSubview(v)
        v.set(circles: list, animate: false)
        self.v = v

reset circles

v.set(circles: list, animate: true,duration:2)

remove circle

v.removeCircleAt(index:6, animate: true)

append circle

v.append(circle: circle, animate: true)
上一篇 下一篇

猜你喜欢

热点阅读