简体   繁体   English

TTStyledText不显示具有“ <”字符的字符串

[英]TTStyledText not displays string which has '<' charcter

I am using TTStyledText to display text on my tableView. 我正在使用TTStyledText在tableView上显示文本。 I came across a problem where, If my TTStyledText text contains '<' character than my complete text becomes null. 我遇到一个问题,如果我的TTStyledText文本包含'<'字符,则我的完整文本为空。

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 . tnc的类型为TTStyledTextLabel

Logs displays the object but text as (null) . 日志显示对象,但文本显示为(null)

Thanks. 谢谢。

Use @"3&#x3C;5" instead of @"3<5" 使用@"3&#x3C;5"代替@"3<5"

Here < is a special entity so you should use html code for < which is &#x3C; 这里<是一个特殊的实体,因此您应将html代码用于< ,即&#x3C; or &lt; &lt; or &#60; &#60; defined here. 在这里定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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