Latest 0.0.4
Homepage https://github.com/mymirror/WebpiOS
License MIT
Platforms ios 8.0, requires ARC
Dependencies SDWebImage
Authors

iOS加载webp后缀的图片(利用google开源c代码)

usegae

1、cocoapod管理

pod ‘WebpiOS’

2、手动导入

把webp文件下的文件导入到工程,同时工程依赖SDWebImage第三方框架

导入头文件

import "UIImage+WebP.h"

@interface UIImage (WebP)

  • (nullable UIImage )sd_imageWithWebPData:(nullable NSData )data;

@end

图片转换工具下载地址
https://github.com/mymirror/webp-.git

such as:

UIImage *img = [UIImage sd_imageWithWebPData:[NSData dataWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"[email protected]" ofType:@"webp"]]];

UIImageView imageview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, img.size.height320/img.size.width)];

[self.view addSubview:imageview];

[imageview setImage:img];

Latest podspec

{
    "name": "WebpiOS",
    "version": "0.0.4",
    "summary": "show webp image",
    "description": "this is display .webp image use google code",
    "homepage": "https://github.com/mymirror/WebpiOS",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "mirror": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/mymirror/WebpiOS.git",
        "tag": "0.0.4"
    },
    "source_files": "WebpiOS/webp/*.{h,m}",
    "requires_arc": true,
    "vendored_frameworks": "WebpiOS/webp/*.framework",
    "dependencies": {
        "SDWebImage": []
    }
}

Pin It on Pinterest

Share This