I have made a string like this one..
NSString *loadString = [NSString stringWithFormat:@"<html><body bgcolor=\"red\"><font color=\"white\">%@</font></body></html>", string];
and now I m loading this string in a UIWEbView like
[webView loadHTMLString:loadString baseURL:nil];
webView.backgroundColor = [UIColor clearColor];
now i should get the background color as red but m not getting any colour its all white. can anyone identify what mistake i m making. Thank开发者_运维知识库s.
use this:
change the opaque value to what is needed backgroundColor can be transparent clearColor or any color you like (for example:redColor)
myWebView.opaque = NO;
myWebView.backgroundColor = [UIColor clearColor];
[myWebView loadHTMLString:
@"<html><body style='background-color: transparent'>
Content</body></html>" baseURL:nil];
精彩评论