CGRect screenFrame = [[UIScreen mainScreen] bounds];
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 38.0, screenFrame.size.width, (screenFrame.size.height-122.0))];
NSURL *url = [NSURL URLWithString:@"http://www.baidu.com"];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[webView setScalesPageToFit:YES];
_bridge = [WebViewJavascriptBridge bridgeForWebView:webView webViewDelegate:self handler:^(id data, WVJBResponseCallback responseCallback) {
// NSLog(@"ObjC received message from JS: %@", data);
responseCallback(@"Response for message from ObjC");
}];
webView.delegate = self;
[webView loadRequest:req];
转载于:https://my.oschina.net/bufenye/blog/362269