- (void)viewDidLoad
{
NSString * html= [self htmlEntityDecode:htmlString];
NSAttributedString *attString = [[NSAttributedString alloc]initWithData:[html dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType} documentAttributes:nil error:nil];
//UITextView
self.textView.attributedText=attString;
//WKWebview
[self.WebView loadHTMLString:html baseURL:nil];
}
- (NSString*)htmlEntityDecode:(NSString*)string
{
string = [string stringByReplacingOccurrencesOfString:@""" withString:@"\""];
string = [string stringByReplacingOccurrencesOfString:@"'" withString:@"'"];
string = [string stringByReplacingOccurrencesOfString:@"<" withString:@"<"];
string = [string stringByReplacingOccurrencesOfString:@">" withString:@">"];
string = [string stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
return string;
}