Skip to content

Commit

Permalink
Inproving the progressTargetTimer management #55
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickl committed Dec 18, 2018
1 parent ee22032 commit 506a0ef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions YLProgressBar/YLProgressBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,13 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated

if (animated)
{
_progressTargetValue = newProgress;
CGFloat incrementValue = ((_progressTargetValue - _progress) * YLProgressBarStripesAnimationTime) / YLProgressBarProgressTime;
_progressTargetValue = newProgress;
CGFloat incrementValue = ((_progressTargetValue - _progress) * YLProgressBarStripesAnimationTime) / YLProgressBarProgressTime;

if (incrementValue == 0) {
return;
}

self.progressTargetTimer = [NSTimer timerWithTimeInterval:YLProgressBarStripesAnimationTime
target:self
selector:@selector(updateProgressWithTimer:)
Expand Down

0 comments on commit 506a0ef

Please sign in to comment.