NSAttributeString initWithData使我的屏幕在IOS 9之后闪烁

NSAttributeString initWithData使我的屏幕在IOS 9之后闪烁,ios,nsattributedstring,Ios,Nsattributedstring,经过长时间的研究,我发现NSAttributedString的initWithData方法在我的屏幕上闪烁。这很奇怪。这在IOS 9之前从未发生过。这是我的密码: NSString *const str = [NSString stringWithFormat:@"<span style=\"font-family: %@; color:%@; font-size:%@\";>%@</span>", fontFace, _shop.currentTheme.options

经过长时间的研究,我发现NSAttributedString的initWithData方法在我的屏幕上闪烁。这很奇怪。这在IOS 9之前从未发生过。这是我的密码:

NSString *const str = [NSString stringWithFormat:@"<span style=\"font-family: %@; color:%@; font-size:%@\";>%@</span>", fontFace, _shop.currentTheme.options.itemDetailTextColor, fontSize,[entity description]];
NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)};

//Screen flickers after the code below
NSAttributedString *const text = [[NSAttributedString alloc] initWithData:data options:options documentAttributes:nil error:nil];
itemDescriptionLabel.text = @"text"; //text;
NSString*const str=[NSString stringWithFormat:@“%@”,fontFace,_shop.currentTheme.options.itemDetailTextColor,fontSize,[实体描述];
NSData*data=[str DATAUSINGENCODE:NSUTF8STRINGENCONDING];
NSDictionary*选项=@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType,NSCharacterEncodingDocumentAttribute:@(NSUTF8StringEncoding)};
//屏幕在以下代码后闪烁
NSAttributedString*常量文本=[[NSAttributedString alloc]initWithData:数据选项:选项文档属性:nil错误:nil];
itemDescriptionLabel.text=@“text”//文本;
我错在哪里

更新:


如果我从选项中删除NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType,它可以正常工作

代码在哪里?如果你用上面的代码创建了一个简单的单视图iOS应用程序,你还看到问题吗?如果我将选项设置为nil,应用程序工作正常。问题是关于我猜的选项。你们并没有回答我的任何问题。这段代码在视图控制器的viewDidLoad方法中。我没有尝试使用单一视图应用程序。因为我现在确定这是因为NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentTypeoption@Burak:当您设置
text
而不是
@“text”
时,是否使用
标签.attributedText
?此代码在哪里?如果你用上面的代码创建了一个简单的单视图iOS应用程序,你还看到问题吗?如果我将选项设置为nil,应用程序工作正常。问题是关于我猜的选项。你们并没有回答我的任何问题。这段代码在视图控制器的viewDidLoad方法中。我没有尝试使用单一视图应用程序。因为我现在确定这是因为NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentTypeoption@Burak:当您设置
text
而不是
@“text”
时,是否使用
标签.attributedText