I'm working on circular progress view and it's working quite cool. But I'd like to make it more flexible, so user would use it like a normal UIProgressView
paired with NSTimer
. I cannot figure how to make equivalent of: setProgress:(float)progress animated:(BOOL)animated
? For now I'm testing with hardcoded values and durations so it's animating nicely, but surely it can be somehow achieved to inform on exact duration value?
Asked
Active
Viewed 788 times
0

raistlin
- 4,298
- 5
- 32
- 46
-
for now 'm not interested in just writing method where I pass time interval and it's handling timer and setting current progress - unless it cannot be done otherwise – raistlin Mar 06 '14 at 11:38
1 Answers
0
got it with CAMediaTimingFunction
which I put inside my method updating CGPath
if (self.continuous) {
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
//animation.duration = 0.5;
animation.fromValue = [NSNumber numberWithFloat:prevValue];
animation.toValue = [NSNumber numberWithFloat:_value];
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
[self.progressLayer addAnimation:animation forKey:@"strokeEndAnimation"];
}

raistlin
- 4,298
- 5
- 32
- 46