I was working on an iPhone app, when I came across a problem, where I had to use UIWebView to show some of the data, but the background should not be shown (I had a background image for my app, and the content of web view should have to be shown just over the app background). But the background of web-view was showing as white color. After googling for sometime, I came across this small piece of code, which solved my problem:

[myWebView setBackgroundColor:[UIColor clearColor]];
[myWebView setOpaque:NO];
[myWebView loadHTMLString:@”<html>\
<body style=”‘background-color:transparent;'”>\

And this small piece worked for me.


Leave a Reply

Your email address will not be published. Required fields are marked *