你好,游客 登录 注册 搜索
背景:
阅读新闻

UIWebView中显示本地图片的方法

[日期:2012-09-02] 来源:Linux社区  作者:jsntghf [字体:大 中 小]

UIWebView中显示本地图片的方法:

html内容如下:

  1. <html>  
  2.     Opening Hours:<br/>  
  3.     Monday to Friday 7am and 7pm<br/>  
  4.     Saturday from 8am until 12noon<br/><br/>  
  5.     Northcross Physiotherapy and Rehabilitation is a Physiotherapy Private Practice situated in the Northcross Specialist Centre. This is a private company established by it's current principle. The practice's primary activity involves the provision of specialist physiotherapy services and education to the local population. This has been in operation at the current site since June 1997 and at premises closer to the Albany Village since 1991. As well as this website, Northcross Physiotherapy also has a Trade Me listing.<br/>  
  6.     <img src="about.png" width="320" height="241"/>  
  7. </html> 

about.png和html文件在同一个目录下。

示例:

  1. NSString *path = [[NSBundle mainBundle] bundlePath];   
  2. NSURL *baseURL = [NSURL fileURLWithPath:path];   
  3. NSString *htmlString = [NSString stringWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"about" ofType:@"html"]  encoding:NSUTF8StringEncoding error:nil];   
  4. [self.webView loadHTMLString:htmlString baseURL:baseURL]; 
linux
相关资讯       iOS开发 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款