解决方案 »

  1.   

    忘记说了,用swift实现。 求大神告诉
      

  2.   

    两种方式:let webView = UIWebView(frame: CGRect(x: 0, y: 0,
        width: self.view.bounds.size.width,
        height: self.view.bounds.size.height))
    self.view.addSubview(webView)
    webView.autoresizingMask = .FlexibleHeight | .FlexibleWidthlet htmlFilePath = NSBundle.mainBundle().pathForResource("FileName", ofType: "html")!
    // 1.
    webView.loadData(NSData(contentsOfFile: htmlFilePath), MIMEType: "text/html", textEncodingName: "UTF-8", baseURL: nil)// 2.
    webView.loadHTMLString(NSString(contentsOfFile: htmlFilePath, encoding: NSUTF8StringEncoding, error: nil), baseURL: nil)
      

  3.   

    都需要先找到html文件的路径,然后以data或htmlString的方式加载到WebView中。