Xamarin iOS:如何从文件路径加载WebP
我的项目是Xamarin iOS项目。 我尝试使用ffimageloading nuget软件包加载图像,方法如下:Xamarin iOS:如何从文件路径加载WebP,ios,xamarin.ios,webp,ffimageloading,Ios,Xamarin.ios,Webp,Ffimageloading,我的项目是Xamarin iOS项目。 我尝试使用ffimageloading nuget软件包加载图像,方法如下: var fileURL = NSBundle.MainBundle.PathForResource("test", "webp"); ImageService.Instance.LoadFile(fileURL).Into(imageView); 我甚至使用了其他可用的方法,如embeddedResource、LoadURL、LoadFileFromApplicationBun
var fileURL = NSBundle.MainBundle.PathForResource("test", "webp");
ImageService.Instance.LoadFile(fileURL).Into(imageView);
我甚至使用了其他可用的方法,如embeddedResource、LoadURL、LoadFileFromApplicationBundle,但都没有用
上述操作均无效,并且imageView为空。同样的代码似乎适用于任何GIF/png文件类型
提前感谢。经过几个小时的斗争: 可以使用称为WebP.Touch(1.0.8)的ffimageloading依赖库完成此操作:
希望它能帮助别人。iOS本机支持WebP吗?Safari不支持它。但是他们的GitHub页面说它支持webp-
WebP.Touch.WebPCodec decoder = new WebP.Touch.WebPCodec();
var fileURL = NSBundle.MainBundle.PathForResource("imageName", "webp");
return decoder.Decode(fileURL);