Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS : WebView Background color to transparent

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?

like image 661
Fahim Parkar Avatar asked Dec 16 '25 22:12

Fahim Parkar


1 Answers

This is all it should take,

[webView setBackgroundColor:[UIColor clearColor]];
[webView setOpaque:NO];
like image 76
nylund Avatar answered Dec 19 '25 13:12

nylund



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!