Progress does not follow interval
daweedm opened this issue · 0 comments
daweedm commented
Hello,
I have a problem with the "image progress"
I want the progress to follow the speed of the interval. I update also an UILabel, that updates at good speed according to the interval, but the image progress doesn't : it simply animate at fixed speed after a short delay ...
Here is my code :
override func viewWillAppear(animated: Bool) {
updateTimer = NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: "upProgress", userInfo: nil, repeats: true)
super.viewWillAppear(animated)
}
func upProgress() {
dispatch_async(dispatch_get_main_queue(), {
self.iconProgress.setProgress(CGFloat(++self.counterProgress) / CGFloat(100), animated: true)
self.progressLabel.text = String(self.counterProgress) + "%"
if(self.counterProgress == 100) {
self.updateTimer.invalidate()
}
})
}
Can anyone help me to fix this ?
Thanks !