html调用的简单调用
1. 首先导入JavaScriptCore.framework
2.添加一个UIWebView
3.获取网络数据
4创建一个html
5.调用函数传值
if let dataArray = dataArray {
let model = dataArray[1]
let alert1 = "document.getElementById(\"pic\").src =\"\(model.pic)\""
self.webView.stringByEvaluatingJavaScriptFromString(alert1)
let alert2 = "document.getElementById(\"title\").innerText =\"\(model.title)\""
self.webView.stringByEvaluatingJavaScriptFromString(alert2)
}
搞定