Merge pull request #3402 from dreampiggy/fix_macOS_animatedview_render
Fix the switching from animated image rendering to static image does not works on macOS 11+
This commit is contained in:
commit
122c3d7ca5
|
@ -192,9 +192,8 @@
|
||||||
|
|
||||||
[self stopAnimating];
|
[self stopAnimating];
|
||||||
[self checkPlay];
|
[self checkPlay];
|
||||||
|
|
||||||
[self.imageViewLayer setNeedsDisplay];
|
|
||||||
}
|
}
|
||||||
|
[self.imageViewLayer setNeedsDisplay];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Configuration
|
#pragma mark - Configuration
|
||||||
|
@ -493,6 +492,11 @@
|
||||||
// If we have no animation frames, call super implementation. iOS 14+ UIImageView use this delegate method for rendering.
|
// If we have no animation frames, call super implementation. iOS 14+ UIImageView use this delegate method for rendering.
|
||||||
if ([UIImageView instancesRespondToSelector:@selector(displayLayer:)]) {
|
if ([UIImageView instancesRespondToSelector:@selector(displayLayer:)]) {
|
||||||
[super displayLayer:layer];
|
[super displayLayer:layer];
|
||||||
|
} else {
|
||||||
|
// Fallback to implements the static image rendering by ourselves (like macOS or before iOS 14)
|
||||||
|
currentFrame = super.image;
|
||||||
|
layer.contentsScale = currentFrame.scale;
|
||||||
|
layer.contents = (__bridge id)currentFrame.CGImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue