Displaying Lots Of RichText : Choosing the best option

后端 未结 2 1582
粉色の甜心
粉色の甜心 2021-01-31 11:06

What is the best way to display lots of RichText (HTML formatted)

At the moment I\'m working on an app for a forum. As you\'d expect the posts

2条回答
  •  醉梦人生
    2021-01-31 11:07

    NSAttributedString+HTML already supports lazy loading of images. See the Demo that shows how to do that. It's reasonably fast but you want to hold of parsing the HTML for content that is not on screen.

    It mostly depends on what UI you want to achieve. NSAS+HTML is meant for situations where you control the quality of the HTML (i.e. because you generate it yourself). There it affords you with an unprecedented level of control over the view hierarchy because you can embed your own custom views to show images.

    In other cases where you cannot be sure about the quality of the HTML you have to use UIWebView and work around all of it's limitations, one being that it takes enormous amounts of RAM and it slow to show the contents. Also UIWebView is not thread-safe (because WebKit is not).

提交回复
热议问题