html - 如何将图像添加到 <p> 并在 UIWebView 中使用?

标签 html ios uiwebview

<分区>


想改进这个问题吗? 通过 editing this post 添加细节并澄清问题.

关闭 9 年前

如何将图像添加到<p>标签?在我的 html 数据中多个 <p>标签。那么我如何设置不同的图像以在 UIWebView 中添加和使用。提前致谢

最佳答案

在 HTML 中添加图像:

<p><img src="yourawesomeimage.png" alt="Awesome!" /></p>

将 HTML 添加到 UIWebView:

NSString* htmlContent = @"<html><head><title></title></head><body><p><img src='image.jpg' /></p></body></html>";
[self.webView loadHTMLString:htmlContent baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];

关于html - 如何将图像添加到 <p> 并在 UIWebView 中使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22405734/

上一篇:ios - 在后台处理远程通知

下一篇:ios - iPhone日期格式中译英

相关文章:

ios - 使用 iOS UIWebView 时的 Rails 布局(application.html.erb)逻辑

javascript - 在一个 div 中居中一个 div

swift - 使用 iOS8 Swift XCode 6 通过 uiwebview 将新样式表注入(inject)网站

javascript - html/jquery 如何在 mouseenter 时将 div 悬停在其子项上

iphone - 特定时间后图像变化

ios - 对多关系作为 sectionNameKeyPath

objective-c - ConvertRect 占 UIScrollView 缩放和 contentOffset

iOS - 临时 session 和 UIWebView

html - 使 div 内容响应

html - (CSS) 具有动态调整大小图像的网格框布局