webview
#pragma mark UIWebViewDelegate
//开始加载
- (void)webViewDidStartLoad:(UIWebView *)webView {
[self startLoad:self.view];
}
//完成加载
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[self stopLoad:self.view];
//获取网页webview的名字
self.title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}
//加载失败
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
NSLog(@"加载失败~");
}
//设置UIWebView的背景颜色为透明
[_webView setBackgroundColor:[UIColor clearColor]];
[_webView setOpaque:NO]; // 一定要设为no,否则更改背景色无效
//加载html
[self._webView loadHTMLString:_mHome.Content baseURL:nil];
//拿到webview的内容宽度跟高度
CGFloatheight = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight"] floatValue];
CGFloat width = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollWidth"] floatValue];
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。