In the process of project development, encountered a problem, is the picture of WEBP, first explain what WEBP is, WEBP is a Google developed to speed up the image of the image format. Image compression volume of about only 2/3 jpeg, plainly is the province of space, especially for mobile apps to the size of the application is still very necessary to save the province.
The problem comes, Apple native does not support WEBP type of picture, then need third-party support, but the third party on the Internet may need to use the cocoapods, but the personal feeling does not like to use, so they need to integrate the resources, in fact, some resources files, got together, Can be directly used on the line, personal feeling very convenient. In this share to everyone.
This is GitHub's address: HTTPS://GITHUB.COM/YOUZHIZHESHIJINGCHENG/YZWEBP
Put the downloaded files directly into the project, then you need toYZ.huiimage+webp.h import to pch file inside , Then find the project target -> Build setting->linking->other Linker flags or -force_load < Span class= "S1" style= "Line-height:normal;" > or -objc
uiimageview* Imagev=[[uiimageview Alloc]initwithframe:cgrectmake (a);
The premise is that 11108.webp images can be in the project.
NSString *pathstr = [[NSBundle mainbundle] pathforresource:@ "11108.WEBP" oftype:nil];
That's it, it feels good to write.
This article is from the "Red Corner Antelope" blog, please be sure to keep this source http://2254359459.blog.51cto.com/10776102/1912470
iOS webp convert jpg