webp图片加载

2021-03-22 08:27

阅读:523

标签:target   flag   targe   color   elf   tin   The   静态库   int   

1.下载该静态库并导入

2.配置工程

TARGETS->Build Settings->Other Linker Flags 添加一个 -ObjC

3.开始应用

    UIImageView* webp=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    //后缀为小写的时候可以省略
    webp.image=[UIImage imageWithWebP:@"a"];
    webp.backgroundColor=[UIColor redColor];
    webp.center=CGPointMake(self.view.center.x, self.view.center.y*0.5);
    [self.view addSubview:webp];

    UIImageView* webp1=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    webp1.image=[UIImage imageWithWebP:@"a.webp"];
    webp1.backgroundColor=[UIColor greenColor];
    webp1.center=self.view.center;
    [self.view addSubview:webp1];

    //名字大小写不对识别不了
    UIImageView* webp2=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    webp2.image=[UIImage imageWithWebP:@"a.WEBP"];
    webp2.center=CGPointMake(self.view.center.x, self.view.center.y*1.5);
    webp2.backgroundColor=[UIColor blueColor];
    [self.view addSubview:webp2];

Demo地址:

webp图片加载

标签:target   flag   targe   color   elf   tin   The   静态库   int   

原文地址:https://blog.51cto.com/2254359459/2487341


评论


亲,登录后才可以留言!