mod: 1. expose animated player 2. modify setup current frame

This commit is contained in:
Insomnia 2020-10-30 11:54:39 +08:00
parent 3926f1bc88
commit 8c108d604f
3 changed files with 6 additions and 6 deletions

View File

@ -143,15 +143,12 @@
if (self.currentFrameIndex != 0) {
return;
}
if (self.playbackMode == SDAnimatedImagePlaybackModeNormal ||
self.playbackMode == SDAnimatedImagePlaybackModeBounce) {
self.currentFrameIndex = 0;
} else if (self.playbackMode == SDAnimatedImagePlaybackModeReverse ||
if (self.playbackMode == SDAnimatedImagePlaybackModeReverse ||
self.playbackMode == SDAnimatedImagePlaybackModeReversedBounce) {
self.currentFrameIndex = self.totalFrameCount - 1;
}
if ([self.animatedProvider isKindOfClass:[UIImage class]]) {
if (!self.currentFrame && [self.animatedProvider isKindOfClass:[UIImage class]]) {
UIImage *image = (UIImage *)self.animatedProvider;
// Use the poster image if available
#if SD_MAC

View File

@ -20,6 +20,10 @@
For AppKit: use `-setAnimates:` to control animating, `animates` to check animation state. This view is layer-backed.
*/
@interface SDAnimatedImageView : UIImageView
/**
The animation player.
*/
@property (nonatomic, strong, nonnull) SDAnimatedImagePlayer *player;
/**
Current display frame image. This value is KVO Compliance.

View File

@ -31,7 +31,6 @@
@property (nonatomic, assign, readwrite) NSUInteger currentLoopCount;
@property (nonatomic, assign) BOOL shouldAnimate;
@property (nonatomic, assign) BOOL isProgressive;
@property (nonatomic, strong, readwrite) SDAnimatedImagePlayer *player; // The animation player.
@property (nonatomic) CALayer *imageViewLayer; // The actual rendering layer.
@end