当前位置: 代码迷 >> Web前端 >> iphone开发 两种形式 UIWebView 显示 html
  详细解决方案

iphone开发 两种形式 UIWebView 显示 html

热度:699   发布时间:2012-10-05 15:34:34.0
iphone开发 两种方式 UIWebView 显示 html
摘自:http://beike.iteye.com/blog/402449

NSBundle* bundle = [NSBundle mainBundle];   
NSString*  resPath = [bunder resourcePath];   
NSString* filePath = [resPath stringByAppendPathComponent:@"test.html"];   
    
[WebView loadHTMLString:[NSString stringWithContentsOfFile:filePath] baseURL:[NSURL fileURLWithPath:[bundle bundlePath]]];  


NSString *fullPath = [NSBundle pathForResource:@"test" ofType:@"html" inDirectory:[[NSBundle mainBundle] bundlePath]];   
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:fullPath]]]; 


[m_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",m_strURL]/*@"http://realtime.zaobao.com/2009/07/090709_26.shtml"*/]]];


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta pageSize=320x360/>
<html>
<head>
</head>

<body>
<img src="Sample.JPG"/>
</body>
</html>
  相关解决方案