iOS:WebView将背景颜色设置为透明(iOS : WebView Background color to transparent)

编程入门 行业动态 更新时间:2024-10-24 00:28:41
iOS:WebView将背景颜色设置为透明(iOS : WebView Background color to transparent)

我想要的是将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];

但是,当我使用这个,我仍然看到背景颜色为白色。 任何想法如何让颜色透明?

What I want is set the background color of webview to transparent.

Below is the code I am using for 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?

最满意答案

这是它应该采取的一切,

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

This is all it should take,

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

更多推荐

webview,transparent,embedHTML,颜色,电脑培训,计算机培训,IT培训"/> <meta name=&q

本文发布于:2023-08-01 14:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1359135.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   透明   颜色   背景   WebView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!