Skip to content

Commit 0b6ea6a

Browse files
committed
v3.6.0 - 1.图片解码方案优化,2.支持设置GIF是否循环播放
1 parent d40e494 commit 0b6ea6a

35 files changed

+1894
-925
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222
* 9.自带图片/视频下载,缓存功能.
2323
* 10.支持预缓存图片及视频.
2424
* 11.支持设置完成动画.
25-
* 12.无依赖其他第三方库等等...
25+
* 12.等等等...
2626

2727
### 技术交流群(群号:537476189).
2828

2929
### 更新记录:
3030

31+
* 2017.09.18 -- v3.6.0 -->1.优化图片解码方案,2.支持设置GIF动图是否循环播放
3132
* 2017.09.13 -- v3.5.8 -->增加几种显示完成的动画...
3233
* 2017.08.20 -- v3.5.6 -->已知问题修复及内存优化...
3334
* 2017.05.26 -- v3.5.4 -->修复横屏启动造成的界面问题...
@@ -281,12 +282,13 @@ configuration.customSkipView = [self customSkipView];
281282
### 7.其他代理方法
282283
```objc
283284
/**
284-
* 图片下载完成/或本地图片读取完成 回调
285+
* 图片本地读取/或下载完成回调
285286
*
286-
* @param launchAd XHLaunchAd
287-
* @param image image
287+
* @param launchAd XHLaunchAd
288+
* @param image 读取/下载的image
289+
* @param imageData 读取/下载的imageData
288290
*/
289-
-(void)xhLaunchAd:(XHLaunchAd *)launchAd imageDownLoadFinish:(UIImage *)image
291+
-(void)xhLaunchAd:(XHLaunchAd *)launchAd imageDownLoadFinish:(UIImage *)image imageData:(NSData *)imageData;
290292
{
291293
NSLog(@"图片下载完成/或本地图片读取完成回调");
292294
}
@@ -351,6 +353,9 @@ configuration.customSkipView = [self customSkipView];
351353
+(NSString *)xhLaunchAdCachePath;
352354

353355
```
356+
## 依赖
357+
* 1.本库依赖FLAnimatedImage
358+
354359
## 安装
355360
### 1.手动添加:<br>
356361
* 1.将 XHLaunchAd 文件夹添加到工程目录中<br>

XHLaunchAd.podspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
Pod::Spec.new do |s|
22
s.name = "XHLaunchAd"
3-
s.version = "3.5.8"
3+
s.version = "3.6.0"
44
s.summary = "The screen opening advertising solutions -开屏广告解决方案,支持图片/视频、静态/动态、全屏/半屏广告,支持iPhone/iPad,自带图片下载、缓存功能,无其他三方依赖"
55
s.homepage = "https://github.com/CoderZhuXH/XHLaunchAd"
66
s.license = { :type => "MIT", :file => "LICENSE" }
77
s.authors = { "Zhu Xiaohui" => "[email protected]"}
88
s.platform = :ios, "7.0"
99
s.source = { :git => "https://github.com/CoderZhuXH/XHLaunchAd.git", :tag => s.version }
10-
s.source_files = "XHLaunchAd", "*.{h,m}"
10+
s.source_files = "XHLaunchAd/XHLaunchAd", "*.{h,m}"
1111
s.requires_arc = true
12+
s.dependency 'FLAnimatedImage', '~> 1.0.12'
1213
end
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
//
2+
// FLAnimatedImage.h
3+
// Flipboard
4+
//
5+
// Created by Raphael Schaad on 7/8/13.
6+
// Copyright (c) 2013-2015 Flipboard. All rights reserved.
7+
//
8+
9+
10+
#import <UIKit/UIKit.h>
11+
12+
// Allow user classes conveniently just importing one header.
13+
#import "FLAnimatedImageView.h"
14+
15+
16+
#ifndef NS_DESIGNATED_INITIALIZER
17+
#if __has_attribute(objc_designated_initializer)
18+
#define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer))
19+
#else
20+
#define NS_DESIGNATED_INITIALIZER
21+
#endif
22+
#endif
23+
24+
extern const NSTimeInterval kFLAnimatedImageDelayTimeIntervalMinimum;
25+
26+
//
27+
// An `FLAnimatedImage`'s job is to deliver frames in a highly performant way and works in conjunction with `FLAnimatedImageView`.
28+
// It subclasses `NSObject` and not `UIImage` because it's only an "image" in the sense that a sea lion is a lion.
29+
// It tries to intelligently choose the frame cache size depending on the image and memory situation with the goal to lower CPU usage for smaller ones, lower memory usage for larger ones and always deliver frames for high performant play-back.
30+
// Note: `posterImage`, `size`, `loopCount`, `delayTimes` and `frameCount` don't change after successful initialization.
31+
//
32+
@interface FLAnimatedImage : NSObject
33+
34+
@property (nonatomic, strong, readonly) UIImage *posterImage; // Guaranteed to be loaded; usually equivalent to `-imageLazilyCachedAtIndex:0`
35+
@property (nonatomic, assign, readonly) CGSize size; // The `.posterImage`'s `.size`
36+
37+
@property (nonatomic, assign, readonly) NSUInteger loopCount; // 0 means repeating the animation indefinitely
38+
@property (nonatomic, strong, readonly) NSDictionary *delayTimesForIndexes; // Of type `NSTimeInterval` boxed in `NSNumber`s
39+
@property (nonatomic, assign, readonly) NSUInteger frameCount; // Number of valid frames; equal to `[.delayTimes count]`
40+
41+
@property (nonatomic, assign, readonly) NSUInteger frameCacheSizeCurrent; // Current size of intelligently chosen buffer window; can range in the interval [1..frameCount]
42+
@property (nonatomic, assign) NSUInteger frameCacheSizeMax; // Allow to cap the cache size; 0 means no specific limit (default)
43+
44+
// Intended to be called from main thread synchronously; will return immediately.
45+
// If the result isn't cached, will return `nil`; the caller should then pause playback, not increment frame counter and keep polling.
46+
// After an initial loading time, depending on `frameCacheSize`, frames should be available immediately from the cache.
47+
- (UIImage *)imageLazilyCachedAtIndex:(NSUInteger)index;
48+
49+
// Pass either a `UIImage` or an `FLAnimatedImage` and get back its size
50+
+ (CGSize)sizeForImage:(id)image;
51+
52+
// On success, the initializers return an `FLAnimatedImage` with all fields initialized, on failure they return `nil` and an error will be logged.
53+
- (instancetype)initWithAnimatedGIFData:(NSData *)data;
54+
// Pass 0 for optimalFrameCacheSize to get the default, predrawing is enabled by default.
55+
- (instancetype)initWithAnimatedGIFData:(NSData *)data optimalFrameCacheSize:(NSUInteger)optimalFrameCacheSize predrawingEnabled:(BOOL)isPredrawingEnabled NS_DESIGNATED_INITIALIZER;
56+
+ (instancetype)animatedImageWithGIFData:(NSData *)data;
57+
58+
@property (nonatomic, strong, readonly) NSData *data; // The data the receiver was initialized with; read-only
59+
60+
@end
61+
62+
typedef NS_ENUM(NSUInteger, FLLogLevel) {
63+
FLLogLevelNone = 0,
64+
FLLogLevelError,
65+
FLLogLevelWarn,
66+
FLLogLevelInfo,
67+
FLLogLevelDebug,
68+
FLLogLevelVerbose
69+
};
70+
71+
@interface FLAnimatedImage (Logging)
72+
73+
+ (void)setLogBlock:(void (^)(NSString *logString, FLLogLevel logLevel))logBlock logLevel:(FLLogLevel)logLevel;
74+
+ (void)logStringFromBlock:(NSString *(^)(void))stringBlock withLevel:(FLLogLevel)level;
75+
76+
@end
77+
78+
#define FLLog(logLevel, format, ...) [FLAnimatedImage logStringFromBlock:^NSString *{ return [NSString stringWithFormat:(format), ## __VA_ARGS__]; } withLevel:(logLevel)]
79+
80+
@interface FLWeakProxy : NSProxy
81+
82+
+ (instancetype)weakProxyForObject:(id)targetObject;
83+
84+
@end

0 commit comments

Comments
 (0)