简体   繁体   English

iOS:WebView背景颜色为透明

[英]iOS : WebView Background color to transparent

What I want is set the background color of webview to transparent. 我想要的是将webview的背景颜色设置为透明。

Below is the code I am using for webview. 下面是我用于webview的代码。

NSString *embedHTML = [NSString stringWithFormat:@"<html><body style=\"background-color: transparent;font-family: verdana;\"><h3>About US</h3></BODY></HTML>"];
[webView loadHTMLString:embedHTML baseURL:nil];    

However when I use this, I still see background color as WHITE. 但是当我使用它时,我仍然将背景颜色视为白色。 Any idea how to get color to transparent? 知道如何让颜色透明吗?

This is all it should take, 这是它应该采取的一切,

[webView setBackgroundColor:[UIColor clearColor]];
[webView setOpaque:NO];

只需添加此行即可。

webView.opaque=NO;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM