I am using webview to display Data from RSS Feed Can I change color of WebView to Black From white.
I have declare outlet in xib file named RemainingRssViewController
and i am diplaying it from root view controller the code is
NSString *htmlstring =[[blogEntries objectAtIndex: blogEntryIndex] objectForKey: @"description"];
NSURL *baseUrl;
baseUrl = [[NSURL alloc]initWithString:feedurl];
[anotherViewController.maintext loadHTMLString:htmlstring baseURL:baseUrl];
//maintext is the UIWebVeiw outlet in anotherViewController.
Ok, looks good.
With this code:
NSString *htmlstring =[[blogEntries objectAtIndex: blogEntryIndex] objectForKey: @"description"];You set up an HTML string to go in the UIWebView. However, it’s not actually HTML, because right now it’s just text. To solve this, we’ll instead make the “htmlstring” to be styled HTML with the text from the XML feed.
For example:
NSString *textString = [[blogEntries objectAtIndex: blogEntryIndex] objectForKey:@"description"];NSString *htmlstring = [NSString stringWithFormat:@"<html><head><style type='text/css'>body { color:#FFFFFF; background-color: #000000; }</style></head><body>%@</body></html>",textString];Then, when the “htmlstring” is placed inside the UIWebView, it will be styled as you would like it to be.