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

一个人想着一个人 提交于 2019-12-11 12:06:54

问题


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?


回答1:


The UIDatePicker shows the default value from your Interface Builder setting. I added UIDatePicker in viewDidLoad{} but not in Interface Builder, it works well.




回答2:


As a workaround for this bug you might catch the UIApplicationWillEnterForegroundNotification and dump and recreate the table cells to get a correct 'today' flag.



来源:https://stackoverflow.com/questions/4733172/uidatepicker-does-not-update-the-today-flag-when-the-date-advances

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!