将图像存储在 plist 中
我从一份 PDF 中戏剧性地获取了七张缩略图,这七张图像作为对象存储在一个数组中。现在我想在 UIWebView
中显示数组中的图像,但这是不可能的,因为 Web 视图需要资源路径或 plist 路径。所以我想将这些图像存储在一个plist中;我该怎么做? 在我的数组中,只有图像对象可用,而不是名称,并且所有七个图像都不是静态图像。
我是 iPhone 编程新手,所以请告诉我如何做到这一点?
I obtain seven thumbnail images from my one PDF melodramatically, and these seven images are stored in one array as objects. Now i want to show the images in the array in a UIWebView
, but it is not possible because the web view needs a path to a resource or a plist path. So I want to store these images in a plist; how can I do this?
In my array, only the image objects are available, not the names, and all seven images are not static images.
I am new in iPhone programming, so please tell me how I can do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的问题对我来说没有多大意义(夸张地?)。与您的想法相反,
UIWebView
无法处理属性列表。它应该用来做什么? Web 视图可以显示来自 URL 请求的数据、HTML 字符串或指定格式的一堆数据。在您的情况下,后者将适用:将您的一张图像转换为
NSData
对象(使用UIImagePNGRepresentation()
),并使用- 将其传递到 Web 视图loadData:MIMEType:textEncodingName:baseURL:
。如果您想一次显示所有图像,则必须将图像保存到磁盘并生成适当的 HTML 代码。
Your question does not make much sense to me (melodramatically?). Contrary to what you believe,
UIWebView
cannot deal with a property list. What would it be supposed to do with it? A web view can display data from a URL request, a string of HTML or a bunch of data in a specified format.In your case, the latter would apply: convert one of your images into an
NSData
object (withUIImagePNGRepresentation()
) and pass it to the web view with-loadData:MIMEType:textEncodingName:baseURL:
.If you want to display all images at once, you would have to save the images to disk and generate appropriate HTML code.