增加换肤功能
This commit is contained in:
49
Pods/SVGAPlayer/Source/SVGAImageView.m
generated
Normal file
49
Pods/SVGAPlayer/Source/SVGAImageView.m
generated
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// SVGAImageView.m
|
||||
// SVGAPlayer
|
||||
//
|
||||
// Created by 崔明辉 on 2017/10/17.
|
||||
// Copyright © 2017年 UED Center. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SVGAImageView.h"
|
||||
#import "SVGAParser.h"
|
||||
|
||||
static SVGAParser *sharedParser;
|
||||
|
||||
@implementation SVGAImageView
|
||||
|
||||
+ (void)load {
|
||||
sharedParser = [SVGAParser new];
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
_autoPlay = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setImageName:(NSString *)imageName {
|
||||
_imageName = imageName;
|
||||
if ([imageName hasPrefix:@"http://"] || [imageName hasPrefix:@"https://"]) {
|
||||
[sharedParser parseWithURL:[NSURL URLWithString:imageName] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
|
||||
[self setVideoItem:videoItem];
|
||||
if (self.autoPlay) {
|
||||
[self startAnimation];
|
||||
}
|
||||
} failureBlock:nil];
|
||||
}
|
||||
else {
|
||||
[sharedParser parseWithNamed:imageName inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
[self setVideoItem:videoItem];
|
||||
if (self.autoPlay) {
|
||||
[self startAnimation];
|
||||
}
|
||||
} failureBlock:nil];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user