Swift加载本地Html

2017-04-13  本文已影响0人  ray_1942


letwebView =UIWebView.init()

webView.scrollView.bounces=false

webView.frame=self.view.bounds

self.view.addSubview(webView)

let path =Bundle.main.bundlePath

let url =URL.init(fileURLWithPath: path)

let htmlPath =Bundle.main.path(forResource:"protocol", ofType:"html")

let htmlContent =try!String.init(contentsOfFile: htmlPath!)

webView.loadHTMLString(htmlContent, baseURL: url)

上一篇 下一篇

猜你喜欢

热点阅读