在UIWebView网页中使用xcassets图像作为img标签的src

时间:2022-12-28 00:32:59

Xcode 5 introduced the possibility to manage all your images in a single assets file, instead of having a bunch of png variants hanging around.

Xcode 5引入了在单个资产文件中管理所有映像的可能性,而不是让一堆png变体挂在那里。

It works great with IB and Cocoa code, but when I try to reference the pictures from an embedded html, they simply do not show.

它对IB和Cocoa代码非常有用,但是当我尝试从嵌入的html中引用图片时,它们根本不显示。

So the question is simple: is it possible to reference xcasset images from an embedded html in a UIWebView?

所以问题很简单:是否可能在UIWebView中引用嵌入html中的xcasset图像?

1 个解决方案

#1


3  

Apparently if you open the app package, the images get all mixed together in a mysterious binary .car format (with the sole exception of the icon and launch image that are still copied as individual files).

显然,如果你打开应用程序包,这些图像就会混合成一个神秘的二进制。car格式(唯一的例外是图标和启动图像,它们仍然被复制为单独的文件)。

Therefore it doesn't seem possible to reference xcassets images from the html source. You'll have to continue to bundle them separately.

因此,似乎不可能从html源引用xcassets图像。你必须继续把它们分开打包。

#1


3  

Apparently if you open the app package, the images get all mixed together in a mysterious binary .car format (with the sole exception of the icon and launch image that are still copied as individual files).

显然,如果你打开应用程序包,这些图像就会混合成一个神秘的二进制。car格式(唯一的例外是图标和启动图像,它们仍然被复制为单独的文件)。

Therefore it doesn't seem possible to reference xcassets images from the html source. You'll have to continue to bundle them separately.

因此,似乎不可能从html源引用xcassets图像。你必须继续把它们分开打包。