I'm trying to display an ad in UIView... I need to set the background color to transparent... I tried using,
[viewObject setBackgroundColor:[UIColor clearcolor]];
Eventhough it made the UIView transparent, it is displaying white background...
Below is the HTML code I tried...
NSString *HTML = [NSString stringWithFormat:@"<html><head><meta name=\"viewport\" content=\"width=device-width, user-scalable=no\"/><style>*{margin:0px;padding:0px}</style>
</head><body style=\" background-color:transparent\"><div style=\"text-align: %@\">%@</div></body></html>",adAlignment,link];
Thanks in advance...
Regards,,
Suraj
Did you also set opaque = NO;
on the view?
I'm not sure if I understood your question, but you should have a UIWebView for your HTML code. To implement a UIWebView with a transparent background all you need to do is
1) set the UIWebView's backgroundColor property to [UIColor clearColor]
2) use the UIWebView's content in the html:
3) the UIWebView's opaque property set to NO.
The above are taken verbatim from Apple's TransWeb sample code ReadMe.txt file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With