将HTML,css和js文件拖入工程。
按照如下方式添加代码
WKWebView *webView = [[WKWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];
webView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:webView];
NSString *htmlPath = [[NSBundle mainBundle] pathForResource:@"yourHtmlFileName" ofType:@"html"];
NSString * htmlCont = [NSString stringWithContentsOfFile:htmlPath
encoding:NSUTF8StringEncoding
error:nil];
NSURL *url = [NSURL fileURLWithPath:[NSBundle mainBundle].bundlePath];
[webView loadHTMLString:htmlCont baseURL:url];