UIWebView右邊出現黑色粗線解決方法
阿新 • • 發佈:2019-02-16
1.公司專案使用系統UIWebView載入Html欄位,有時會在右邊出現一條黑色的線,具體的解決辦法是
_contentV.opaque = NO;
_contentV.backgroundColor = [UIColor clearColor];
在懶載入裡面這樣設定,就可以解決出現黑色粗線的問題。
2.在原生專案中可以使用下面的方法改變UIWebView內容的一些顯示情況
- (void)webViewDidFinishLoad:(UIWebView *)webView{ //字型大小 [self.contentV stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '220%'"]; //字型顏色 [self.contentV stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.webkitTextFillColor= 'gray'"]; //頁面背景色 [self.contentV stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.background='#3D2E2E'"]; }