How can I fake a progress bar to make my app look a lot more complicated than it is...
for _ in 1...4{
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
print("test")
self.Proggress.progress += 0.25
}
}
This code is just loading a finished bar without simulating "progress."
let progressView = UIProgressView(progressViewStyle: .default)
for _ in 1...4{
DispatchQueue.main.asyncAfter(deadline: .now() + Double(i) * 0.5) {
self.progressView.setProgress(0.25, animated: true)
}
}
因为所有时间都在0.5
的持续时间内同时触发,所以通过将for
循环中的_
替换for
i
.now() + Double(i) * 0.5
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.