【问题标题】:Adding Image in the UIWebView [duplicate]在 UIWebView 中添加图像 [重复]
【发布时间】:2012-07-04 10:53:58
【问题描述】:

我有一个UIWebView,我只是在显示一些文本。我正在使用 html 文本来格式化 UIWebView。我怎样才能在其中包含image/UIImage?我需要显示具有固定框架的图像。

【问题讨论】:

标签: iphone ios uiwebview uiimageview


【解决方案1】:

使用img 标签。将其注入您的 HTML 代码并在 UIWebView 中呈现。

这应该会有所帮助 -

NSString *html = @"<html><body style='margin:0;'><img width='300' height='300' src='my_test_image.jpg'></body></html>";
[web loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 2013-03-25
    • 2012-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多