Fix the switching from animated image rendering to static image does not works on macOS 11+
We should always provide a fallback solution to handle built-in NSImageView logic
This commit is contained in:
parent
d3b111deb1
commit
61c3c5ba2d
|
@ -192,9 +192,8 @@
|
|||
|
||||
[self stopAnimating];
|
||||
[self checkPlay];
|
||||
|
||||
[self.imageViewLayer setNeedsDisplay];
|
||||
}
|
||||
[self.imageViewLayer setNeedsDisplay];
|
||||
}
|
||||
|
||||
#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 ([UIImageView instancesRespondToSelector:@selector(displayLayer:)]) {
|
||||
[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