I have save a string like this..
NSString *loadString = [NSString stringWithFormat:@"<html><body><font color=\"white\">%@</font></body></html>", string];
Now i want to load this string in a webview using
[webView loadHTMLString:loadString baseURL:nil];
now when the webpage is loaded the colour is default as black. I want to change the colour to white but m unable to do so. any suggestion how can i change the font colour.Thanks.
EDIT 1:
I tried this but no luck..
NSString *htmlString = [NSString stringWithFormat:@"<html><style type=\"text/css\"><!--.style1 { font-family: Arial;color: #FFFFFF;font-size: 20px;font-weight: bold;}--> <body><font class=\"style1\">%@</font></body></html>", string];
also this..
NSString *htmlString = [NSString stringWithFormat:@"<html> \n""<head> \n""<style type=\"text/css\"> \n""body {font-family: \"%@\"; font-size: %@; color:#FFFFFF; }\n""</style> \n""</head> \n""<body>%@</body> \n""</html>", @"helvetica", [NSNumber numberWithInt:15], string];
Here is a full listing. Just create a view controller + NIB called “WebViewTestViewController” and add the webView in your nib file and connect it.
WebViewTestViewController.h:
WebViewTestViewController.m: