func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell") as? CustomTableViewCell
cell!.lblVerseNo.text = "\(indexPath.row + 1)"
cell!.lblDescription.attributedText = self.tableViewArr.objectAtIndex(indexPath.row) as? NSAttributedString
return cell!
}
tableViewArr包含HTML属性字符串,如下所示
if let htmlData = str.dataUsingEncoding(NSUnicodeStringEncoding) {
do {
let attributedString = try NSAttributedString(data: htmlData, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil)
tableViewArr.addObject(attributedString)
} catch let e as NSError {
print("Couldn't translate \(str): \(e.localizedDescription) ")
}
}
这就是我做的..... 但是,在滚动桌面视图的同时,它仍然存在于真实设备中。它在模拟器中完美运行..
提前致谢.......