Closed harish-kamath closed 4 years ago
UIView
progress animation isn't working for me either, in a brand new single-view project. Example code is essentially straight out of the README, and plopped into viewDidAppear
. I don't know if I'm just missing something dumb, but the ring just appears completed immediately. Strangely, if I set a completed block, that will run when the animation should have finished.
Same issues for me. No animation.
I currently have the progress view in a table view cell. The progress value sets correctly, but there is no animation, despite using UIView.animate. Other animations work fine. It seems that upon reloading the cell, animation works correctly.
UIView.animate..... not work for me too, but you can try like this:
extension RingProgressView {
func animateTo(_ number : Int) {
let now = DispatchTime.now()
for index in 0...number {
let milliseconds = 10 * index
let deadline: DispatchTime = now + .milliseconds(milliseconds)
DispatchQueue.main.asyncAfter(deadline: deadline) {
self.progress = Double(index)/100
}
}
}
}
Just checked on the ProgressRingExample project - animation works without any issues with the following code:
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
UIView.animate(withDuration: 1.0) {
self.ringProgressView.progress = 0.5
}
}
Maybe there are some additional changes in your code that affect the animations?
Happening to me too. Still looking into it, but on line 115 of RingProgressLayer, presentation()?.value(forKey: event)
= nil, which I don't expect is correct
Deleted my last comment, sorry -- I posted PR #71 with a potential fix (works for me)
Hey guys, I pushed a small modification of a fix (#71) provided by @xaphod. I tried it on a table view setup and it worked for me. Please let me know if there are still any issues.
Hi @maxkonovalov , does the progress can take negative value?
@zeinrezky negative values are not supported, but if you need anti-clockwise direction, you can use it like this: progressView.transform = CGAffineTransform(scaleX: -1, y: 1)
I currently have the progress view in a table view cell. The progress value sets correctly, but there is no animation, despite using UIView.animate. Other animations work fine. It seems that upon reloading the cell, animation works correctly.