Question

I am using TTStyledText to display text on my tableView. I came across a problem where, If my TTStyledText text contains '<' character than my complete text becomes null.

TTStyledText *text = [TTStyledText textFromXHTML:@"3<5" lineBreaks:YES URLs:YES];

[tnc setText:text];

NSLog(@"tnc - %@ & Text is - %@", tnc, tnc.text);

tnc is of type TTStyledTextLabel.

Logs displays the object but text as (null).

Thanks.

Was it helpful?

Solution

Use @"3&#x3C;5" instead of @"3<5"

Here < is a special entity so you should use html code for < which is &#x3C; or &lt; or &#60; defined here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top