diff --git a/Source/Classes/AnimatedImages/PINAnimatedImageView.m b/Source/Classes/AnimatedImages/PINAnimatedImageView.m index 8ef426fc..a4a69df1 100644 --- a/Source/Classes/AnimatedImages/PINAnimatedImageView.m +++ b/Source/Classes/AnimatedImages/PINAnimatedImageView.m @@ -211,14 +211,10 @@ - (void)startAnimating if ([self canBeVisible] == NO) { return; } - - // Get frame interval before holding display link lock to avoid deadlock - NSUInteger frameInterval = self.animatedImage.frameInterval; if (_displayLink == nil) { _playHead = 0; _displayLink = [PINDisplayLink displayLinkWithTarget:[PINRemoteWeakProxy weakProxyWithTarget:self] selector:@selector(displayLinkFired:)]; - _displayLink.frameInterval = frameInterval; _lastSuccessfulFrameIndex = NSUIntegerMax; [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.animatedImageRunLoopMode]; @@ -361,7 +357,7 @@ - (void)displayLinkFired:(PINDisplayLink *)displayLink _playHead = 0; _playedLoops++; } - + if (self.animatedImage.loopCount > 0 && _playedLoops >= self.animatedImage.loopCount) { [self stopAnimating]; return;