UICircularProgressRing does not animate
johnrajahkkd opened this issue · comments
johnrajahkkd commented
Hi,
I have added the UICircularProgressRing programmatically,
Also, I have set min and max value for the and start the progress. But it does not animates.
Here is my code,
class ViewController: UIViewController {
lazy var progressRing: UICircularProgressRing = { [unowned self] in
let ring = UICircularProgressRing(frame: CGRect(x: 150, y: 300, width: 125, height: 125))
ring.minValue = 0
ring.maxValue = 100
return ring
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(progressRing)
progressRing.startProgress(to: 100, duration: 4.0)
}
}
Can anyone tell what's the issue here? Thanks!
MobileMon commented
You need to move the animation code to viewDidAppear instead of viewDidLoad
Luis Padron commented
As @MobileMon mentions animation needs to be done after the view appears.