The company's project has a home page to load a git diagram of about 2M, just do when the use of Sdwebimage inside the method:
+ (UIImage *)sd_animatedGIFNamed:(NSString *)name;+ (UIImage *)sd_animatedGIFWithData:(NSData *)data;
The use of this method after the discovery of a rapid increase in memory 300M, on the internet to find some methods:
//在didReceiveMemoryWarning方法中释放SDImage的缓存即可!- (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. [[SDWebImageManagersharedManager]cancelAll]; [[SDImageCachesharedImageCache]clearDisk];}
But after using it, the results were not obvious, so the flanimatedimage was used.
Flanimatedimage is an engine that renders Gif animations for IOS.
Function:
-
Multiple GIFs can be played simultaneously
Animation, speed comparable to desktop browser
-
Variable Frame delay
-
Low memory footprint
-
Can eliminate or block delay on first loop playback
-
Animation Frame Latency resolution performance comparable to browser
Example code:
|
FLAnimatedImage *image = [FLAnimatedImage animatedImageWithGIFData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://upload.wikimedia.org/wikipedia/commons/2/2c/Rotating_earth_%28large%29.gif"]]]; FLAnimatedImageView *imageView = [[FLAnimatedImageView alloc] init]; imageView.animatedImage = image; imageView.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); [self.view addSubview:imageView];
|
:
IOS Gif Rendering Engine Flanimatedimage-b