简体   繁体   中英

How To Parse html String from UIWebview for richtexteditor in iphone

I am using RichTextEditor exactly as detailed in this link and I need to show the written content in table view in other class on a button click, but in the table view cell, corresponding html string is appearing. Following is my code

-(void)submitClicked{
  contentObject.webCOntent=webView;
            contentObject.savedMessage=SAVED;
            contentObject.str = [webView stringByEvaluatingJavaScriptFromString: 
                         @"document.body.innerHTML"];
            NSLog(@"created  %@",contentObject.str);
}

in tableView cellforRowAyIndexPath,

cell.textLabel.text = [[notesArray objectAtIndex:indexPath.row]str ];

When I run the app,its Showing in tableview Oiuo8

where, contentObject is modelclass object and str is string and webcontent is UIWebView in model class

I got the solution finally by changing contentObject.str = [webView stringByEvaluatingJavaScriptFromString: @"document.body.innerHTML"]; to contentObject.str = [webView stringByEvaluatingJavaScriptFromString: @"document.documentElement.textContent"];,its giving the normal text instead of html text.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM