WebView相關

禁止WebView的彈跳和滾動:

[(UIScrollView *)[[webView subviews] objectAtIndex:0] setBounces:NO];
[(UIScrollView *)[[webView subviews] objectAtIndex:0] setScrollEnabled:NO];
    設置UIWebView的背景顏色爲透明

  [_webView setBackgroundColor:[UIColor clearColor]];
  [_webView setOpaque:NO];
- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSString *title =  [webView stringByEvaluatingJavaScriptFromString:@"document.title"];//獲取當前頁面的title  

   NSString *currentURL = webView.request.URL.absoluteString;  
    NSLog(@"title-%@--url-%@--",title,currentURL);  

   NSString *lJs = @"document.documentElement.innerHTML";//獲取當前網頁的html  
   self.currentHTML = [webView stringByEvaluatingJavaScriptFromString:lJs];  

}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章