【问题标题】:How To Parse html String from UIWebview for richtexteditor in iphone如何从 UIWebview 为 iphone 中的 Richtexteditor 解析 html 字符串
【发布时间】:2012-02-06 06:22:20
【问题描述】:

我使用的 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 是模型类对象,str 是字符串,webcontent 是模型类中的UIWebView

【问题讨论】:

  • 你的 NSLog 语句是怎么说的?您如何将 contentObject 放入 notesArray?

标签: iphone html-parsing richtextediting


【解决方案1】:

我最终通过更改 contentObject.str = [webView stringByEvaluatingJavaScriptFromString: @"document.body.innerHTML"];到 contentObject.str = [webView stringByEvaluatingJavaScriptFromString: @"document.documentElement.textContent"];,它给出的是普通文本而不是html文本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-11
    • 1970-01-01
    • 1970-01-01
    • 2019-12-18
    • 2011-04-05
    • 1970-01-01
    • 2016-06-12
    • 1970-01-01
    相关资源
    最近更新 更多