【发布时间】:2010-06-18 06:26:16
【问题描述】:
在我的应用程序中,我需要放置一些从解析数据中获取的文本。目前我正在将它放在标签中。问题是会有一些 html 标签在该明文中指示图像 [连同其 url] 和视频等。处理这种识别图像和视频标签并将相应的图像和视频与其余明文动态放置的好方法是什么?
编辑:
假设我有以下文字
<img alt="" src="http://www.abc.com/editorial/wp-content/uploads/2010/05/hattos-150x150.jpg" title="Graduation" class="alignnone" width="150" height="150" />
For many, graduation is the time when they start thinking of their career planning. Many of you know that they want to make a difference, but don't know how to go past that statement.
然后在显示时我想显示一个由 url 指示的图像来代替
<img alt="" src="http://www.abc.com/editorial/wp-content/uploads/2010/05/hattoss-150x150.jpg" title="Graduation" class="alignnone" width="150" height="150" />
和 显示
For many, graduation is the time when they start thinking of their career planning. Many of you know that they want to make a difference, but don't know how to go past that statement.
因为它在图像下方。这应该在运行时发生。也可能有一个视频网址代替图片网址。
提前感谢。
【问题讨论】:
-
这个问题对我来说不是很清楚。你得到什么样的数据?为什么有网址?那个标签是什么?可以发一个示例代码库来理解吗?
-
我得到的数据是明文数据。在该数据中,将嵌入标签,例如 MyImage 之类的图像标签。因此,在显示文本时,我需要保持纯文本数据不变,并将 html 标记中指示的图像显示为图像。这应该在运行时发生。
-
@neha 首先,img 元素没有结束标记 (),因此图像标记无论如何都不会包含这样的文本。不过,您可以使用替代文本。你的问题还不清楚。您是否想说“您如何显示图像并使其替代文本也显示在页面上?”
-
@Evan Plaice 你说的对,img 元素没有结束标签。感谢您纠正我。请检查我编辑的问题。
-
@neha 我想我想念的是,你到底想创造什么?
标签: iphone html dynamic-data