PhoneGap iOS App: Change Background Color

By default, PhoneGap generates an iOS app with a black background.
This works fine for a lot of apps, but especially with iOS 7 and the transparent status bar, you might want to changes this to better fit to your app’s design.

The color can be changed in your iOS apps main view controller. PhoneGap generates this by default to platforms/ios/Classes/MainViewController.m

In this file, search for the method

- (void)webViewDidFinishLoad:(UIWebView*)theWebView

and change the line

theWebView.backgroundColor = [UIColor blackColor];

to whatever color you perfer. For example to have a white background:

theWebView.backgroundColor = [UIColor whiteColor];

Leave a Comment