一. 准备工作
Xcode 拖进html项目文件夹
目录如下
image.png
二.webView加载html关键代码
if let url = Bundle.main.url(forResource: "index", withExtension: "html",subdirectory: "local/app") {
self.webView.load(URLRequest(url: url))
}
Xcode 拖进html项目文件夹
if let url = Bundle.main.url(forResource: "index", withExtension: "html",subdirectory: "local/app") {
self.webView.load(URLRequest(url: url))
}
本文标题:Swift 加载本地html
本文链接:https://www.haomeiwen.com/subject/meqvcdtx.html
网友评论