Ecarrion Ecarrion - 24 days ago 10
iOS Question

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?

Answer

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).