Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core Text to render HTML content


I was wondering if is there a way to render html content using core text, because the common UIWebView is slow as hell to load up.

I've got very basic needs:
- reading p tags
- reading span tags
- using colors
- using fonts and sizes

that's all.

thanks you so much!
k

like image 392
holographix Avatar asked Dec 08 '25 12:12

holographix


1 Answers

ok I solved this in a bit tricky way.
I implemented a HTMLParser to extract the characters that I needed to be formatted in a different way. than I proceeded to use the string in Core-Text.

my references were

[HTMLParser] https://github.com/zootreeves/Objective-C-HMTL-Parser
remember that this one has a problem by parsing two tags one after another
(e.g. < p >< span >. . . < /span >< /p >)

[kickstart for CoreText] https://github.com/jonasschnelli/I7CoreTextExample

like image 54
holographix Avatar answered Dec 11 '25 01:12

holographix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!