简体   繁体   中英

TTStyledText not displays string which has '<' charcter

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM