views:

272

answers:

2

My app's main view has a uiwebview. It is white for a split second before it has time to render the HTML the app generates.

Is there a way to make the uiwebview black, or another color, before it renders? The flash of white isn't part of my plan for a smooth visual transition.

Objective-C or MonoTouch answers are fine, I am bi-lingual.

+1  A: 

One thing you can try is put a UIView with the color you want and position it above the UIWebView with the same width and height. Then in the webViewDidFinishLoad method, set the UIView to hidden.

DyingCactus
+2  A: 

Another thing to try is to make the view transparent:

webView.backgroundColor = [UIColor clearColor];
webView.opaque = NO;

This causes additional compositing work, however, so you can reset these values to something more friendly for that after your web view loads, in webViewDidFinishLoad:.

- (void) webViewDidFinishLoad:(UIWebView *)webView
{
    webView.backgroundColor = [UIColor blackColor];
    webView.opaque = YES;
}
Steve Madsen