0

I'm using phonegap to develop a mobile app. The datepicker on ios 7 gets a dark background (see image). How do I change the color of the background?

See image examples at: http://community.phonegap.com/nitobi/topics/dark_background_for_datepicker_on_ios_7

  • 1
    possible duplicate of [can I change the font color of the datePicker in iOS7?](http://stackoverflow.com/questions/18807940/can-i-change-the-font-color-of-the-datepicker-in-ios7) – benka Nov 21 '13 at 15:31
  • you'll find answers about background color change too in the above post – benka Nov 21 '13 at 15:32
  • Duplicate? Im asking how to change the background color not the font color. – user3018187 Nov 22 '13 at 09:46
  • have you checked that post and the answers? Sulthan probably has an answer there. And others have answers for changing background color too... – benka Nov 22 '13 at 09:49
  • 1
    Yep that's a solution but I don't think it's the solution when you are developing with the Cordova / Phonegap framework. – user3018187 Nov 22 '13 at 10:51
  • The main idea behind Cordova / Phonegap is to make apps cross platform compatible. But an iOS7 style datepicker will only work in iOS7. I used phonegap for app development but there were couple of specific things I had to go and change in Objective-C, so I don't see any problem using that solution :) – benka Nov 22 '13 at 19:06

2 Answers2

3

I just ran into the same exact issue, and found the answer! If you are building the Cordova/PhoneGap project locally on your machine and are NOT using PhoneGapBuild, the fix is really simple.

In Xcode, open your project, expand the yellow Classes folder and open MainViewController.m file.

On line 107 of MainViewController.m you see the line below :

theWebView.backgroundColor = [UIColor blackColor];

Change it to :

theWebView.backgroundColor = [UIColor whiteColor];


Alternatively, if you are using PhoneGapBuild and don't have access to modify the iOS project files, someone developed a cordova/phonegap plugin to fix this issue. It can be found below.

https://github.com/EddyVerbruggen/iOSWebViewColor-PhoneGap-Plugin

njtman
  • 2,160
  • 1
  • 19
  • 32
-3

Have you tried the jquery mobile datepicker..

http://jquerymobile.com/demos/1.0a4.1/experiments/ui-datepicker/