美文网首页
IOS webview调用HTML内部的方法

IOS webview调用HTML内部的方法

作者: 1ac244776e12 | 来源:发表于2017-03-29 11:36 被阅读0次

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]];

相关文章

网友评论

      本文标题:IOS webview调用HTML内部的方法

      本文链接:https://www.haomeiwen.com/subject/ukyeottx.html