`
jsntghf
  • 浏览: 2482147 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

加载html内容

    博客分类:
  • iOS
阅读更多

html内容:

 

<html>
    <head>
        <style type="text/css">
            p {
                margin:10px 20px 10px 20px; 
            }
        </style>
    </head>
    <body style="background-color: transparent;">
        <p>
        <font face="helvetica" size=+3><b>10 Reasons you should write something Each Day!!!</b></font>
        </p>
        <font face="helvetica">
            <p>
            1. Remove stress from mind, place on paper.<br/> 
            2. Sweep Your Mind.<br/>  
            3. Keep Your Writing Skills Sharp.<br/>  
            4. Make Some Pocket Money.<br/>             
            5. Turn the Noise Off.<br/>  
            6. Enhance Your Communication Skills.<br/>  
            7. Know What You Want.<br/>             
            8. Develop Your Analytical Skills.<br/>  
            9. Get Away from Technology.<br/>  
            10. Meet Yourself All Over Again.
            </p>
        </font>
    </body>
</html>

 

实现:

 

NSString *path = [[NSBundle mainBundle] pathForResource:@"WebView" ofType:@"html"];
NSFileHandle *readHandle = [NSFileHandle fileHandleForReadingAtPath:path];	
NSString *htmlString = [[NSString alloc] initWithData: 
                        [readHandle readDataToEndOfFile] encoding:NSUTF8StringEncoding];	
webView.opaque = NO; 
webView.backgroundColor = [UIColor clearColor];
[self.webView loadHTMLString:htmlString baseURL:nil];
[htmlString release];

 

示例图:

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics