我正在 Xcode 开发一个简单的 RSS 阅读器应用程序,作为一个初学者项目。目前我已经设置好了,它可以解析提要,放置标题、发布日期、描述和内容,并在 WebView 中显示它。
我最近决定在用于选择文章的 TableView 中显示描述(或内容的截断版本)。不过,在这样做时:
cell.textLabel?.text = item.title?.uppercaseString
cell.detailTextLabel?.text = item.itemDescription //.itemDescription is a String
它显示了文章的原始 HTML。
我想知道如何将 HTML 转换成纯文本,只用于 TableView 的详细 UILabel。
谢谢!