Skip to content

Commit

Permalink
v3.6.0 - 1.图片解码方案优化,2.支持设置GIF是否循环播放
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderZhuXH committed Sep 18, 2017
1 parent d40e494 commit 0b6ea6a
Show file tree
Hide file tree
Showing 35 changed files with 1,894 additions and 925 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
* 9.自带图片/视频下载,缓存功能.
* 10.支持预缓存图片及视频.
* 11.支持设置完成动画.
* 12.无依赖其他第三方库等等...
* 12.等等等...

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

### 更新记录:

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

```
## 依赖
* 1.本库依赖FLAnimatedImage

## 安装
### 1.手动添加:<br>
* 1.将 XHLaunchAd 文件夹添加到工程目录中<br>
Expand Down
5 changes: 3 additions & 2 deletions XHLaunchAd.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Pod::Spec.new do |s|
s.name = "XHLaunchAd"
s.version = "3.5.8"
s.version = "3.6.0"
s.summary = "The screen opening advertising solutions -开屏广告解决方案,支持图片/视频、静态/动态、全屏/半屏广告,支持iPhone/iPad,自带图片下载、缓存功能,无其他三方依赖"
s.homepage = "https://github.com/CoderZhuXH/XHLaunchAd"
s.license = { :type => "MIT", :file => "LICENSE" }
s.authors = { "Zhu Xiaohui" => "[email protected]"}
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/CoderZhuXH/XHLaunchAd.git", :tag => s.version }
s.source_files = "XHLaunchAd", "*.{h,m}"
s.source_files = "XHLaunchAd/XHLaunchAd", "*.{h,m}"
s.requires_arc = true
s.dependency 'FLAnimatedImage', '~> 1.0.12'
end
84 changes: 84 additions & 0 deletions XHLaunchAd/Lib/FLAnimatedImage/FLAnimatedImage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
//
// FLAnimatedImage.h
// Flipboard
//
// Created by Raphael Schaad on 7/8/13.
// Copyright (c) 2013-2015 Flipboard. All rights reserved.
//


#import <UIKit/UIKit.h>

// Allow user classes conveniently just importing one header.
#import "FLAnimatedImageView.h"


#ifndef NS_DESIGNATED_INITIALIZER
#if __has_attribute(objc_designated_initializer)
#define NS_DESIGNATED_INITIALIZER __attribute((objc_designated_initializer))
#else
#define NS_DESIGNATED_INITIALIZER
#endif
#endif

extern const NSTimeInterval kFLAnimatedImageDelayTimeIntervalMinimum;

//
// An `FLAnimatedImage`'s job is to deliver frames in a highly performant way and works in conjunction with `FLAnimatedImageView`.
// It subclasses `NSObject` and not `UIImage` because it's only an "image" in the sense that a sea lion is a lion.
// 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.
// Note: `posterImage`, `size`, `loopCount`, `delayTimes` and `frameCount` don't change after successful initialization.
//
@interface FLAnimatedImage : NSObject

@property (nonatomic, strong, readonly) UIImage *posterImage; // Guaranteed to be loaded; usually equivalent to `-imageLazilyCachedAtIndex:0`
@property (nonatomic, assign, readonly) CGSize size; // The `.posterImage`'s `.size`

@property (nonatomic, assign, readonly) NSUInteger loopCount; // 0 means repeating the animation indefinitely
@property (nonatomic, strong, readonly) NSDictionary *delayTimesForIndexes; // Of type `NSTimeInterval` boxed in `NSNumber`s
@property (nonatomic, assign, readonly) NSUInteger frameCount; // Number of valid frames; equal to `[.delayTimes count]`

@property (nonatomic, assign, readonly) NSUInteger frameCacheSizeCurrent; // Current size of intelligently chosen buffer window; can range in the interval [1..frameCount]
@property (nonatomic, assign) NSUInteger frameCacheSizeMax; // Allow to cap the cache size; 0 means no specific limit (default)

// Intended to be called from main thread synchronously; will return immediately.
// If the result isn't cached, will return `nil`; the caller should then pause playback, not increment frame counter and keep polling.
// After an initial loading time, depending on `frameCacheSize`, frames should be available immediately from the cache.
- (UIImage *)imageLazilyCachedAtIndex:(NSUInteger)index;

// Pass either a `UIImage` or an `FLAnimatedImage` and get back its size
+ (CGSize)sizeForImage:(id)image;

// On success, the initializers return an `FLAnimatedImage` with all fields initialized, on failure they return `nil` and an error will be logged.
- (instancetype)initWithAnimatedGIFData:(NSData *)data;
// Pass 0 for optimalFrameCacheSize to get the default, predrawing is enabled by default.
- (instancetype)initWithAnimatedGIFData:(NSData *)data optimalFrameCacheSize:(NSUInteger)optimalFrameCacheSize predrawingEnabled:(BOOL)isPredrawingEnabled NS_DESIGNATED_INITIALIZER;
+ (instancetype)animatedImageWithGIFData:(NSData *)data;

@property (nonatomic, strong, readonly) NSData *data; // The data the receiver was initialized with; read-only

@end

typedef NS_ENUM(NSUInteger, FLLogLevel) {
FLLogLevelNone = 0,
FLLogLevelError,
FLLogLevelWarn,
FLLogLevelInfo,
FLLogLevelDebug,
FLLogLevelVerbose
};

@interface FLAnimatedImage (Logging)

+ (void)setLogBlock:(void (^)(NSString *logString, FLLogLevel logLevel))logBlock logLevel:(FLLogLevel)logLevel;
+ (void)logStringFromBlock:(NSString *(^)(void))stringBlock withLevel:(FLLogLevel)level;

@end

#define FLLog(logLevel, format, ...) [FLAnimatedImage logStringFromBlock:^NSString *{ return [NSString stringWithFormat:(format), ## __VA_ARGS__]; } withLevel:(logLevel)]

@interface FLWeakProxy : NSProxy

+ (instancetype)weakProxyForObject:(id)targetObject;

@end
Loading

0 comments on commit 0b6ea6a

Please sign in to comment.