UITextView无效的字形索引

时间:2017-06-14 20:55:36

标签: ios swift nsattributedstring

我在故事板中创建了{{ (course | async)?.title }} <ul> <li *ngFor="let teacher of (course | async)?.teachers"> {{ teacher.firstname }} </li> </ul> 。我从一些html创建了一系列UITextView s。 html格式正确,但其中一些包含表标记。第一次使用UITextView不会产生任何错误。如果我用“简单的html”更新UITextView,它似乎工作正常。如果我然后使用从表生成的字符串更新,那么我得到:

  

_NSLayoutTreeSetOutsideDrawsUponLineFragmentAtGlyphIndex无效的字形索引0

字形索引会有所不同,如果文字很长,我可能会得到很多这些。

这是一个示例字符串(包含一些Unicode藏文):

NSAttributedString

我创建了NSAttributedString:

static let record2 = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" +
"<html>" +
"<head>" +
"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">" +
"<title></title>" +
"</head>" +
"<body>" +
"" +
"<h1>This is a partial list </h1><br /><table><tr><td>888</td><td>8888 88</td><td>9999</td></tr></table><br />77777 ཞུ་དག་པ་<br /></body></html>"

我不知道如何调试它。此外,当我打印String.description时,看起来NSAttributedString包含对NSTableView的引用,NSTableView是一个仅限OS X的库。

0 个答案:

没有答案