方法1
UILable 顯示 html文字 出的問題解決,使用多線程創建 attribute 對象
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
//耗時的操作
NSAttributedString* remainNumStr = [[NSAttributedStringalloc]initWithData:[remainnumStrdataUsingEncoding:NSUnicodeStringEncoding]options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType}documentAttributes:nilerror:nil];
dispatch_async(dispatch_get_main_queue(), ^{
//更新界面
self.contentLabel.attributedText=remainNumStr;
});
});
方法2
更改刷新數據的方法
[tableview ?reloadData]
改為:
[self.tableViewreloadSections:[NSIndexSetindexSetWithIndex:0]withRowAnimation:UITableViewRowAnimationNone];