UIWebView自適應高度

iosbg 9年前發布 | 2K 次閱讀 Objective-C IOS

//webview自適應高度     delegate里面實現

  • (void)webViewDidFinishLoad:(UIWebView *)webView

{

NSString *height_str= [webViewstringByEvaluatingJavaScriptFromString: @"document.body.offsetHeight"];

heightCell = [height_str intValue];

webView.frame = CGRectMake(0,0,320,heightCell);

NSLog(@"height: %@", [webViewstringByEvaluatingJavaScriptFromString: @"document.body.offsetHeight"]);

}

//禁止web滑動

jobRequestWeb.scrollView.bounces = NO;

//取消web右邊滑動條

jobRequestWeb.scrollView.showsVerticalScrollIndicator = NO;</pre>

 本文由用戶 iosbg 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!