I have a simple query but don't know how to do it.
This is what I am trying to achieve: 1) I have a UILabel with todays date i.e. "29/04/12" 2) At midnight I want that label to update by itself to "30/04/12" without needing to change view or press anything.
It's step 2 that I don't know how to do. I have idea's of how it would be done such as potentially getting a system notification of the date change (if this is even possible) or using some sort of timer as a trigger.
Any help would be greatly appreciated, thanks in advance.
If you are only interested in being notified when midnight arrives (or a couple other cases), then you can override UIApplicationDelegate's - (void)applicationSignificantTimeChange:(UIApplication *)application
method so that it causes your labels to update. Of course, you'll also want to update the labels whenever the application re-enters the foreground, since this method won't be called if your app is in the background when the date changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With