ios - Get HTML in UITextView -
i display html in uitextview
by:
[self.textview setvalue:@"<b>content</b>" forkey:@"contenttohtmlstring"];
,
after editing content in uitextview
, want content include html use:
[self.textview valueforkey:@"contenttohtmlstring"];
app crash, how fix it?
for ios 7 use following code.
nsstring *htmlstring = @"<h1>header</h1><h2>subheader</h2><p>some <em>text</em></p><img src='http://blogs.babble.com/famecrawler/files/2010/11/mickey_mouse-1097.jpg' width=70 height=100 />"; nsattributedstring *attributedstring = [[nsattributedstring alloc] initwithdata:[htmlstring datausingencoding:nsunicodestringencoding] options:@{ nsdocumenttypedocumentattribute: nshtmltextdocumenttype } documentattributes:nil error:nil]; textview.attributedtext = attributedstring;
Comments
Post a Comment