【问题标题】:How to show htmlString into webview? The html string contains bootstrap image如何将 htmlString 显示到 webview 中? html 字符串包含引导图像
【发布时间】:2018-07-26 06:42:04
【问题描述】:

HTML 字符串是:

<p> Business Name and City Located In <i class=\"fa fa-check\"></i></p>\r\n

【问题讨论】:

    标签: ios swift webview


    【解决方案1】:
    let webview = UIWebView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
    
    let htmlString = "<p> Business Name and City Located In <i class=\"fa fa-check\"></i></p>\r\n"
    let fontAwesomeHtml = """
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">\(htmlString)
    """
    webview.loadHTMLString(fontAwesomeHtml, baseURL: nil)
    view.addSubview(webview)
    

    结果截图:

    【讨论】:

      猜你喜欢
      • 2011-10-08
      • 1970-01-01
      • 1970-01-01
      • 2014-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-11
      • 1970-01-01
      相关资源
      最近更新 更多