Add a double check on SDAnimatedImageView's startAnimating, don't actually do animation when not visible

This commit is contained in:
DreamPiggy 2019-11-08 22:28:29 +08:00
parent b75c227433
commit eef82411c4
1 changed files with 6 additions and 6 deletions

View File

@ -178,11 +178,8 @@
// Ensure disabled highlighting; it's not supported (see `-setHighlighted:`).
super.highlighted = NO;
// Update should animate
[self updateShouldAnimate];
if (self.shouldAnimate) {
[self startAnimating];
}
// Start animating
[self startAnimating];
[self.imageViewLayer setNeedsDisplay];
}
@ -312,7 +309,10 @@
- (void)startAnimating
{
if (self.player) {
[self.player startPlaying];
[self updateShouldAnimate];
if (self.shouldAnimate) {
[self.player startPlaying];
}
} else {
#if SD_UIKIT
[super startAnimating];