Skip to content

Instantly share code, notes, and snippets.

@pietrorea
Created October 3, 2014 16:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pietrorea/49a5b9f8a6440afdbc1a to your computer and use it in GitHub Desktop.
Save pietrorea/49a5b9f8a6440afdbc1a to your computer and use it in GitHub Desktop.
NSString *html = @"<bold>Wow!</bold> Now <em>iOS</em> can create <h3>NSAttributedString</h3> from HTMLs!";
NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType};
NSAttributedString *attrString = [[NSAttributedString alloc] initWithData:[html dataUsingEncoding:NSUTF8StringEncoding] options:options documentAttributes:nil error:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment