JS oc相互调用方法:
1.利用定义url调用
2.利用js直接调用
3.利用js里对象调用
首先先创建UIWebView对象,加载本地html文件
//加载本地html文件
NSString *htmlPath = [[NSBundle mainBundle] pathForResource:@"jsbridge" ofType:@"html"];
//NSString *htmlPath1 = [[NSBundle mainBundle] pathForResource:@"jsbridge" ofType:@"html"];
//NSString *htmlPath2 = [[NSBundle mainBundle] pathForResource:@"jsbridge" ofType:@"html"];
NSString *htmlString = [NSString stringWithContentsOfFile:htmlPath encoding:NSUTF8StringEncoding error:nil];
_webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
[_webView loadHTMLString:htmlString baseURL:nil];
_webView.delegate = self;
[self.view addSubview:_webView];
实现UIWebViewDelegate
//网页是否要加载
- (BOOL)webView:(UIWebView *)webView s