[MonoTouch] Background color of a UIWebView
Guido Van Hoecke
guivho at gmail.com
Sat Oct 22 05:17:51 EDT 2011
I have two xibs where I add a UIWebView in code. The html is also built
in code and sets a specific background color, say maroon.
This works as expected on the simulator, but on the iPhone there's
always a short but disturbing period during which a plain white view is
shown which is then replaced by my html with the maroon background.
I've tried creating the view in either 'ViewWillAppear' or in
'ViewDidLoad' but the problem occurs in both cases.
I've tried to avoid the white background by creating the UIWevView with
e.g. a hard-coded black background as in
var webView = new UIWebView() { Frame = frame, BackgroundColor =
UIColor.Black };
but the black never shows, and it still gives the white flash background
on the iPhone, and not on the simulator.
I realize that this has all the characteristics of a possible timing
(processing power) problem where the simulator on the mac is obviously
more powerful than the iPhone. Tho only activity that may be a bit time
consuming is the generation of the html string so I tried it with a hard
coded string which has only a maroon colored empty body. Same problem
though.
This is so frustrating as it really looks very sloppy on the device.
Please advise, and TIA,
Guido
More information about the MonoTouch
mailing list