I am creating an application that should display a list of strings, the string is returned from the server and can be either an html or not. I am currently setting the text inside a UILabel. to do that i am using the below
NSMutableAttributedString *attributedTitleString = [[NSMutableAttributedString alloc] initWithData:[title dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
cell.label.attributedText =attributedTitleString;
When the text is an html, everything work perfectly since the font and alignments are returned inside the html. The issue is occurring when the text is a normal text. The font, text alignment, text size and others are not being respected anymore.
So how can I check if the text is an html string or not? I will be using the following in case of normal text:
cell.label.text =title;
I have tried to search on forums but still didn't get any answer for my issue.