我正在使用RichTextEditor完全按照此link详细说明,我需要在按钮单击时在其他类的表视图中显示书面内容,但在表视图单元格中,会出现相应的html字符串。以下是我的代码
-(void)submitClicked{
contentObject.webCOntent=webView;
contentObject.savedMessage=SAVED;
contentObject.str = [webView stringByEvaluatingJavaScriptFromString:
@"document.body.innerHTML"];
NSLog(@"created %@",contentObject.str);
}
在tableView cellforRowAyIndexPath中,
cell.textLabel.text = [[notesArray objectAtIndex:indexPath.row]str ];
当我运行应用程序时,它在tableview中显示 Oiuo8
其中,contentObject是modelclass对象,str是字符串,webcontent是模型类中的UIWebView
答案 0 :(得分:0)
我最终通过更改contentObject.str = [webView stringByEvaluatingJavaScriptFromString获得了解决方案: @ “document.body.innerHTML”];至 contentObject.str = [webView stringByEvaluatingJavaScriptFromString: @“document.documentElement.textContent”] ;,它给出普通文本而不是html文本。