Clicky

iOS Dev Nugget 289 Set Background Color for UIWebView to Match App While Still Loading Documents

.

Need to run a code review on your codebase? Hire me

UIWebView is (still) useful for showing web-based documents — such as help or FAQs — in your app. If the document background color and app's background color don't match and aren't white, you might sometimes see the the UIWebView's white background color appear for a split second the first time a document is loaded.

You can't fix this by setting UIWebView's background color, because it is ignored. Here's an easy way to fix this:

Set webview.isOpaque to false and make sure the UIViewController instance holding the UIWebView has the correct background color.

Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues