Created
August 29, 2014 02:49
-
-
Save Neo-J/cd3c855198927f545ee1 to your computer and use it in GitHub Desktop.
使用NSAttributedString来解析html字符串
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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