我有代碼,其中我每增加一個常數到我的數組,我怎樣才能更新我的進度條每秒更改數組時更改?如何一步一步更新我的進度條?
var array: [Int] = []
override func viewWillAppear(_ animated: Bool) {
upgradeArray()
}
func upgradeArray() {
for i in 0...10 {
sleep(1)
array.append(i)
print(i)
let percentProgress = Float(Float(self.array.count)*100.0/10.0)
progressBar.setProgress(percentProgress, animated: true)
}
}
我需要展現給用戶如何基將提取 – Skie