如何在iphone中为richtexteditor解析UIWebview中的html字符串



我使用的RichTextEditor与此链接中的详细信息完全一样,我需要在单击按钮时在其他类的表视图中显示写入的内容,但在表视图单元格中,会出现相应的html字符串。以下是我的代码

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

在表中RowAyIndexPath的View单元格中,

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

当我运行该应用程序时,它在表视图中显示Oioo8;

其中,contentObject是模型类对象,str是字符串,webcontent是模型类中的UIWebView

通过更改contentObject.str=[webView字符串ByEvaluatingJavaScriptFromString:@"document.body.innerHTML"];到contentObject.str=[webView字符串ByEvaluatingJavaScriptFromString:@"document.docentElement.textContent"];,它给出的是普通文本而不是html文本。

最新更新