I am using a UITextView to display text on a screen. I also want to display HTML text in the same TextView. What I want is, when the string contains any HTML data then it should be displayed according to HTML formatter otherwise textview should use the font defined by me.
Here is the code I am using to display the HTML text in the textview:
NSString *htmlString = promotion.content;
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
self.promotionTextView.attributedText = attributedString;
I just want to check if the string that I am receiving in the htmlString contains any html data or not. How I can do that?