如何在 iOS 中编写间隙类型自定义进度视图?

问题描述

我试图快速编写自定义进度视图。但我无法在进度图像中制造这种差距。 我该如何编码:

enter image description here

我设法得到了这个:

enter image description here

代码

let progress = Progress(totalUnitCount: 10)

func screenloder() {
    splashProgressView.transform = splashProgressView.transform.scaledBy(x: 1,y: 4)
    splashProgressView.progress = 0.0
    progress.completedUnitCount = 0
    
    Timer.scheduledTimer(withTimeInterval: 0.3,repeats: true) { (timer) in
        guard self.progress.isFinished == false else {
            timer.invalidate()
            return
        }
        
        self.progress.completedUnitCount += 1
        self.splashProgressView.setProgress(Float(self.progress.fractionCompleted),animated: true)
    }
    
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)