IOS webview调用HTML内部的方法

2017-03-29  本文已影响0人  1ac244776e12

self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];

self.webView.delegate=self;

[self.view addSubview:self.webView];

NSURL *url = [NSURL URLWithString:@"http://ssel/index.html"];

NSURLRequest *request = [NSURLRequest requestWithURL:url];

[self.webView loadRequest:request];

在web view加载完成后执行

getUserModelCallback是内部函数

strJson   json字符串参数

[self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"getUserModelCallback(%@)",strJson]];

上一篇 下一篇

猜你喜欢

热点阅读