UIWebView displays a small amount of local content, approximately 3 paragraphs of text and one 100x100px. When a UIWebView is entered on the nav controller, it takes about half a second to display the content. This happens on the device, not in the simulator. Obviously, a UIWebView needs to do some work before displaying the content, but is there a way to do this before the pushed view appears? I was not lucky to do it myself.
Here I create and click on a view controller containing a UIWebView:
ArticleViewController* viewController = [[ArticleViewController alloc] init];
viewController.article = article;
[viewController view];
[viewController loadWebView];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
And here is the method loadWebView:
-(void)loadWebView {
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
NSString* content = article.content;
NSString *html = [NSString stringWithFormat:@"\
<html><body style='background-color: transparent'><style type=""text/css"">body {font-family: helvetica; color: black; font-size: 10pt; margin: 10px 10px 10px 10px}</style>\
%@<div style='text-align:center'><a href='13443574_9709e4cf37.jpg?photographer=test' style='-webkit-tap-highlight-color:rgba(0,0,0,0);'><img src='13443574_9709e4cf37.jpg' height='160' width='230'></a></div></body></html>", content];
[self.webView loadHTMLString:html baseURL:baseURL];
}
I used to have [viewController loadWebView]a viewDidLoad method, but the result seemed to be the same. A blank screen when you click viewController, and then load the contents in half a second.
Any ideas?