UIWebview transparent background
I had some mixed success with this. Setting the background to transparent in the html code and using a clear bground for the webview, I was able to see the page correctly all the time in the simulator, running 2.1.
If I ran the code on the device, still using 2.1, the webview wouldn't display any contents until I went back a screen, and then reloaded the page. This works everytime, but is clearly not acceptable.
I've tried allocating the webview, setting it to hidden, and then unhiding it when the page has loaded - I can see the NSLog reporting that its loaded, and the view shows up. Then each time I would release the view when done. I've also tried never setting it to hidden - same thing.
I've tried a ton of permutations with the HTML code. I've tried setting the body, html css properties in the <head> to make the background transparent. I've validated the document using strict xhtml standards. I've tried evaluating the document object model property for background as an expression and assigning it that way, and the simple body tag attribute. All produce the same results.
In 2.2, a white background appears when using a transparent background - both on the device, and in the simulator.
Going back to 2.0, I see no diff. between that and 2.1 where this feature is concerned.
Any takers?
EDIT
___________________
The 2.1 solution was to compress the code in the HTML document. I'm not sure why that made a difference with the background -- it always displayed correctly with a color background, just not with transparency.
2.2 still doesn't work.
Last edited by Julinar; 12-10-2008 at 10:56 PM.
|