开发者

Need help with html tags in iphone

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜