开发者

does TTStyledText textFromXHTML not support the underline tags?

开发者 https://www.devze.com 2023-02-26 06:17 出处:网络
Does TTStyledText textFromXHTML not support the underline tags? I note for the the following code the bold\'ing works, however the underline portion doesn\'t seem to?

Does TTStyledText textFromXHTML not support the underline tags?

I note for the the following code the bold'ing works, however the underline portion doesn't seem to?

NSString* htmlTitle = [NSString stringWithFormat:@"UnderlinedBoldNormal", w开发者_如何转开发e.title]; 
self.ttTitlelabel.text = [TTStyledText textFromXH`TML:htmlTitle];


Nope I don't think so. The amount of formatting that TTStyledText supports is pretty limited


There is no native support for underlined or strikethrough fonts on iOS. However you can overcome this by drawing your own line. A style could be created in your stylesheet:

- (TTStyle*)underlineStyle
{
  //custom TTStyle implementation
} 

You could then get underlined text by:

NSString* htmlTitle = [NSString stringWithFormat:@"<span class=\"underlineStyle\">%@</span>", we.title]; 
self.ttTitlelabel.text = [TTStyledText textFromXHTML:htmlTitle];
0

精彩评论

暂无评论...
验证码 换一张
取 消