views:

209

answers:

1

I'm handling UIApplicationSignificantTimeChangeNotification in my app and all the other screens in the app are gracefully refreshed when midnight comes. The one I have trouble with is with UIDatePicker. UIPickerView has refreshAllComponents method which I use in another screen to make an update on midnight change. I would like to have the same for UIDatePicker, but unfortunately I couldn't find a way to refresh it, and Today remains Today, although it is already Yesterday. Any way out?

+1  A: 

You can refresh the UIDatePicker using its method

- (void)setDate:(NSDate *)date animated:(BOOL)animated

Simply pass as the date argument [NSDate date] and YES as the animated argument. This should work since after midnight [NSDate date] must produce the correct current date.

unforgiven
Same shit. Yes, it moves to the next date, but what was Today remains Today, while it is already yesterday.
Aleks N.