How-To: Make UIWebView transparent

How-To: Make UIWebView transparent

Common problem, need to apply nice HTML formatting for a section of your page, but want the UIWebView not to appear as a big white box – only the content of the UIWebView to appear. How to do it?

myWebView.opaque = NO;
myWebView.backgroundColor = [UIColor clearColor];
[myWebView loadHTMLString:
@"<html><body style='background-color: transparent'>
       Content Here</body></html>" baseURL:nil];