Skip to content

Instantly share code, notes, and snippets.

@Neo-J
Created August 29, 2014 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neo-J/d42f5c2a03d257eba3bf to your computer and use it in GitHub Desktop.
Save Neo-J/d42f5c2a03d257eba3bf to your computer and use it in GitHub Desktop.
使用NSAttributedString创建html字符串
NSAttributedString *attrString; // from previous code
NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType};
NSData *htmlData = [attrString dataFromRange:NSMakeRange(0, [attrString length]) documentAttributes:options error:nil];
NSString *htmlString = [[NSString alloc] initWithData:htmlData encoding:NSUTF8StringEncoding];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment