【问题标题】:How to display this html structured json response in Swift如何在 Swift 中显示这个 html 结构的 json 响应
【发布时间】:2020-09-04 19:24:26
【问题描述】:

我收到了来自 json 的回复 文字:"<p>Lorem ipsum</p><p><img src="url/some-image"></p>[[youtube]]<p>Here is youtube url show as embed</p>[[twitter]]<p>Same as youtube</p><p>Lorem ipsum</p>"

如何在我的应用程序中(例如在网络上)显示这一点?我可以用 SwiftUI 做到这一点吗? 我需要做什么?

【问题讨论】:

    标签: ios json swift iphone swiftui


    【解决方案1】:

    创建一个 UIWebView() 并将其作为插座连接。通过这样做,它应该直接在您的 Swift 页面上加载您的 HTML 代码。希望这会有所帮助!

    myWebView.loadHTMLString("<p>Lorem ipsum</p><p></p>[[youtube]]<p>Here is youtube url show as embed</p>[[twitter]]<p>Same as youtube</p><p>Lorem ipsum</p>", baseURL: nil)
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-02
    • 1970-01-01
    • 2020-04-20
    • 2021-07-04
    • 1970-01-01
    • 2017-10-06
    • 1970-01-01
    • 2022-01-20
    相关资源
    最近更新 更多