Body text for displaying HTML content


I was wondering if there is a way to render html content using the main text, because the generic UIWebView is slower than the hell to load.

I have basic needs:
- reading p-tags
- reading markup tags
- using colors
- using fonts and sizes

what all.

Thank you very much!
to

+3
source share
3 answers

ok I decided it is a little harder. I implemented HTMLParser to extract characters that I needed to format in a different way. than i started using string in core-text.

my links were

[HTMLParser] https://github.com/zootreeves/Objective-C-HMTL-Parser
, ,
(, <p> <span> . </span> </p> )

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

+2

: https://github.com/Cocoanetics/DTCoreText

Core Text, HTML NSAttributedString.

+1

:

fooobar.com/questions/50417/...

DTCoreText, iOS 7 ( ).

( : NSHTMLTextDocumentType):

[[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUTF8StringEncoding] 
                                 options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
                                           NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)} 
                      documentAttributes:nil 
                                   error:nil];
0

Source: https://habr.com/ru/post/1792032/


All Articles