Search code examples
iphonedateuidatepicker

UIDatePicker does not update the 'Today' flag when the date advances


I have a UIDatepicker created in UIBuilder and instantiated once when the app first loads. When first presented, the datepicker correctly flags today's date with the word 'Today'. On IOS 4, if I dismiss the app to the background, and reactivate it a day later, the date has advanced, but yesterdays date is still flagged as 'Today'. Explicitly updating the controls date has no effect. It looks like the control determines 'Today' only once, when created.

I've tried calling init to re-initialise it in-situ, but can't get that to work.

Am I missing something?


Solution

  • You can use UIDatePicker from Interface Builder. But when you return to the app you need to execute

    [datePicker sizeToFit];

    and it will updates "Today" cell.