Escape from IoS HTML

Source: Internet
Author: User
NSString *htmlstring = @ "<font color=\" #6c6c6c \ "> Happy every day, still left <font color=\" #ff9147 \ ">365 Day"; nsattributedstring *attributedstring = [[Nsattributedstring alloc] initwithdata:[htmlstring dataUsingEncoding: Nsutf8stringencoding] Options:@{nsdocumenttypedocumentattribute:nshtmltextdocumenttype, nscharacterencodingdocumentattribute:@ (nsutf8stringencoding)} Documentattributes:nil Error:nil];

Encounter HTML string, need to show, sometimes need to escape, with the above method can be shown, if the format is not standard format, must be converted into a standard format to display,


This article is from the "snowflakes flying over the World" blog, please be sure to keep this source http://smengxiang.blog.51cto.com/11204872/1871972

Escape from IoS HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.