Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle time events on iOS?

I'm coding an iPad app, and I have to change a graphic when the day changes to Sunday.

My straightforward solution is to check the day in the - (void)applicationDidBecomeActive:(UIApplication *)application or -(void)viewWillAppear:(BOOL)animated methods, and set a timer like every 10 mins to check if the day have changed to Sunday while the app is active.

Is there another, perhaps more efficient, way to handle this?

like image 510
Ecarrion Avatar asked Nov 15 '11 16:11

Ecarrion


1 Answers

In your appliciation delegate, implement the following method: -(void)applicationSignificantTimeChange:(UIApplication *)application

This method is called when the day changes, or if the device's time has been changed in the background for whatever reason (such as changes to time zone).

like image 62
zeroimpl Avatar answered Sep 20 '22 02:09

zeroimpl