Latest 1.1.4
Homepage https://github.com/WelkinXie/WKWebImage
License MIT
Platforms ios 7.0, requires ARC
Authors

Simply one line, downloads and shows an image in an UIImageView asynchronously.

Usage

pod ‘WKWebImage’ and #import

Method

Include four methods:

// Download and show asynchronously. (default)
- (void)wk_setImageWithURL:(NSURL *)url;

// default + placeholder
- (void)wk_setImageWithURL:(NSURL *)url placeholder:(UIImage *)placeholder;

// default + call back
- (void)wk_setImageWithURL:(NSURL *)url completion:(void (^)(UIImage *image))comletion;

// default + placeholder + call back
- (void)wk_setImageWithURL:(NSURL *)url placeholder:(UIImage *)placeholder completion:(void (^)(UIImage *image))comletion;

e.g.

[_imageView wk_setImageWithURL:[NSURL URLWithString:@"http://7xneqd.com1.z0.glb.clouddn.com/fiveinarow.png"]];

Simply one line! :)

Clear the Cache

WKWebImage will cache the image. Remove them with the below methods:

// Clear the cache in RAM.
[[WKWebImageManager sharedManager] clearMemory];

// Clear the cache in disk.
[[WKWebImageManager sharedManager] clearDisk];

License

WKWebImage is released under MIT License.

中文说明

一行代码实现UIImageView的异步加载、缓存图片。

演示

pod ‘WKWebImage’#import

异步加载图片

包含以下四种设置方法:

// 异步加载图片
- (void)wk_setImageWithURL:(NSURL *)url;

// 加载 + 设置placeholder
- (void)wk_setImageWithURL:(NSURL *)url placeholder:(UIImage *)placeholder;

// 加载 + 设置回调
- (void)wk_setImageWithURL:(NSURL *)url completion:(void (^)(UIImage *image))comletion;

// 加载 + placeholder + 回调
- (void)wk_setImageWithURL:(NSURL *)url placeholder:(UIImage *)placeholder completion:(void (^)(UIImage *image))comletion;

例如

[_imageView wk_setImageWithURL:[NSURL URLWithString:@"http://7xneqd.com1.z0.glb.clouddn.com/fiveinarow.png"]];

一行代码即可 :)

清除缓存

WKWebImage 会把已加载的图片缓存到本地,如果要清除缓存,可调用以下方法:

// 清除内存中的缓存
[[WKWebImageManager sharedManager] clearMemory];

// 清除本地的缓存
[[WKWebImageManager sharedManager] clearDisk];

许可

WKWebImageMIT License 发布.

Latest podspec

{
    "name": "WKWebImage",
    "version": "1.1.4",
    "summary": "u4e00u884cu4ee3u7801u5b9eu73b0UIImageViewu7684u5f02u6b65u52a0u8f7du3001u7f13u5b58u56feu7247",
    "homepage": "https://github.com/WelkinXie/WKWebImage",
    "license": "MIT",
    "authors": {
        "Welkin Xie": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/WelkinXie/WKWebImage.git",
        "tag": "1.1.4"
    },
    "source_files": "WKWebImage/WKWebImage/*.{h,m,md}",
    "requires_arc": true
}

Pin It on Pinterest

Share This