I want to change the background color of the webview. Not for the HTML document it display but for the actual scroll view which can be scrolled. If you scroll a web view you see a gray background color. I have tried below code for this but not working for me. Actually I want to make it transparent.
[detailWebV setOpaque:NO];
detailWebV.backgroundColor = [UIColor clearColor];
开发者_StackOverflowThanks in advance!
Try this
myWebView.opaque = NO;
myWebView.backgroundColor = [UIColor clearColor];
[myWebView loadHTMLString:
@"<html><body style='background-color: transparent'>
Content Here</body></html>" baseURL:nil];
Another way is to set it by using JavaScript:
[yourWebView stringByEvaluatingJavaScriptFromString:@"document.body.style.background = '#000000';"];
the following has worked for me . This is what I wanted , when I scroll down the web view , the background should be transparent .
[webV setOpaque:YES];
webV.backgroundColor = [UIColor clearColor];
Thank you all !!!
精彩评论