3

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?

Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276

2 Answers2

10

This is all it should take,

[webView setBackgroundColor:[UIColor clearColor]];
[webView setOpaque:NO];
Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276
nylund
  • 1,105
  • 10
  • 15
2

Just add this line.

webView.opaque=NO;
MadhuP
  • 2,019
  • 17
  • 22