开发者

Need help with html tags in iphone

开发者 https://www.devze.com 2023-03-14 19:51 出处:网络
I have made a string like this one.. NSString *loadString = [NSString stringWithFormat:@\"<html><body bgcolor=\\\"red\\\"><font color=\\\"white\\\">%@</font></body></

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

精彩评论

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

关注公众号