Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器 软件资源

软件开发小程序制作系统集成与运维空间租用硬件开发视频监控技术咨询与支持——联系电话:0311-88999002/88999003

首页 / 操作系统 / Linux / UIWebView中显示本地图片的方法

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];