IOS中如何顯示帶有html標簽的富文本


    NSString *strHTML = @"<p>你好</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;這是一個例子,請顯示</p><p>外加一個table</p><table><tbody><tr class=\"firstRow\"><td valign=\"top\" width=\"261\">aaaa</td><td valign=\"top\" width=\"261\">bbbb</td><td valign=\"top\" width=\"261\">cccc</td></tr></tbody></table><p></p>";
     
    UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bonus];
    [self.view addSubview:webView];
     
    [webView loadHTMLString:strHTML baseURL:nil];

 

主要是通過   loadHTMLString:strHTML  這個方法實現


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM