0

RichContentLabel for iOS

-
Full

It's a small browser render engine for browser, using Core-Text without leverage the UIWebView.

  • It has its own smart HTML parser, who can handle all invalid cases, such as unclosed tags and overlapping tags.
  • Fully supports image layout as well as text formatted layout.
  • Useful callback function for link tapping event and image tapping event.

GitHub

 

0

DTCoreText for iOS

-

This project aims to duplicate the methods present on Mac OSX which allow creation of NSAttributedString from HTML code on iOS. This is useful for drawing simple rich text like any HTML document without having to use a UIWebView. (Previously known as "NSAttributedString Additions for HTML")

Full

GitHub

0

HTML-парсер для iOS

-

У меня ушло много времени на поиски простого и эффективного решения для парсинга html в iOS, пробовал кучу вариантов, от работы с NSString до зубодробительных regexp и долго не находилось ничего путного. Пока однажды не набрел на https://github.com/zootreeves/Objective-C-HMTL-Parser. Простой и эффективный wrapper для работы с html.

Установка:
1. Скачиваем проект по ссылке выше. Разархивируем и кидаем все .h и .m файлы в наш проект
2. В project settings в разделе «header search paths» прописываем «/usr/include/libxml2»
3. В папку Frameworks нажимаем «Add -> Existing Frameworks» и в списке выбираем libxml2.dylib

Использование:

  1.         NSError * error = nil;
  2.     HTMLParser * parser = [[HTMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.yandex.ru"] error:&error];   
  3.     if (error) {
  4.         NSLog(@"Error: %@", error);
  5.         [parser release];
  6.         parser = nil;
  7.         return;
  8.     }
  9.     HTMLNode * bodyNode = [parser doc]; // получаем родительский элемент
  10.  
  11.         HTMLNode *mynode = [bodyNode findChildWithAttribute:@"id" matchingName:@"all" allowPartial:TRUE]; // Берем div с id="all"
  12.         NSArray *newsList = [mynode findChildTags:@"li"]; // получаем NSArray HTMLNode элеметнов содержащих li тэги с новостями на главной
  13.         for (HTMLNode *news in newsList) { // Пробегаем по списку тэгов и выводим новости
  14.             NSLog(@"Новость: %@", [news allContents]); // выводим текст из HTMLNode news и всех children
  15.         }
  16.  
  17.         [parser release]; // освобождаем память
        NSError * error = nil;
	HTMLParser * parser = [[HTMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.yandex.ru"] error:&error];	
	if (error) {
		NSLog(@"Error: %@", error);
		[parser release];
		parser = nil;
		return;
	}
	HTMLNode * bodyNode = [parser doc]; // получаем родительский элемент

        HTMLNode *mynode = [bodyNode findChildWithAttribute:@"id" matchingName:@"all" allowPartial:TRUE]; // Берем div с id="all"
        NSArray *newsList = [mynode findChildTags:@"li"]; // получаем NSArray HTMLNode элеметнов содержащих li тэги с новостями на главной
        for (HTMLNode *news in newsList) { // Пробегаем по списку тэгов и выводим новости
            NSLog(@"Новость: %@", [news allContents]); // выводим текст из HTMLNode news и всех children
        }

        [parser release]; // освобождаем память

Полный список методов прокомментирован в .h файлах, все предельно просто. :)
Так же инструкция на английском есть на блоге автора – [link].
Парсер сделан на основе libxml и если что можно дописать свои методы. Все благодарности его автору :)

0

CMHTMLView for iOS

-

CMHTMLView is UIWebView wrapper to provide easy access to show rich text content (HTML) with native look and feel. Features: 100% native look and feel, offline images support, low memory usage.

Full
You can find CMHTMLView and the example at the Github repo here.

Features

  • 100% native look and feel
  • Offline images support
  • Low memory usage
  • Stable (never crashed)
0

Customizable Library For Beautiful Easy Text Display With HTML Like Tags

-

I’ve also mentioned some libraries in the past such like this library allowing you to split up your text into multiple columns easily using core text.

With this library you can customize the fonts and coloring, and then use html style tags to very quickly format your text.  Included is a demo project that you can follow to see exactly how this is done.

Here’s a screenshot showing a segment from the demo proejct:

 

The  library is FTCoreText from Fuerte International.  You can find the Github repository here.

A great library to spruce up a page of text quickly and easily.