0
我有一個使用HTML製作的NSAttributedString。NSAttributedString在文本視圖中不顯示NSLink
NSAttributedString *decodedString = [[NSAttributedString alloc] initWithData:[encodedString dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: [NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:nil error:nil];
self.story.attributedText = decodedString;
當我運行代碼和查看的TextView(self.story)所有從HTML文本和圖像顯示除了超鏈接(HTTP)。
它們佔據的空間是存在的,但聯繫不
例如:超鏈接是________________應該在那裏。 只是沒有____它的空白。
控制檯顯示的NSAttributedString顯示
{
NSColor = "UIDeviceRGBColorSpace 0 0 0.933333 1";
NSFont = "<UICTFont: 0x15654c230> font-family: \"Times New Roman\"; font-weight: normal; font-style: normal; font-size: 12.00pt";
NSKern = 0;
NSLink = "https://www.kickstarter.com/projects/1425492550/sesame-your-key-reinvented";
NSParagraphStyle = "Alignment 4, LineSpacing 0, ParagraphSpacing 12, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (\n), DefaultTabInterval 36, Blocks (null), Lists (null), BaseWritingDirection 0, HyphenationFactor 0, TighteningFactor 0, HeaderLevel 0";
NSStrokeColor = "UIDeviceRGBColorSpace 0 0 0.933333 1";
NSStrokeWidth = 0;
NSUnderline = 1;
}
但 「https://www.kickstarter.com/projects/1425492550/sesame-your-key-reinvented」 是無處可尋。
任何有關爲什麼會發生這種情況的想法以及我如何解決這個問題?