Here is what I have tried so far:
- (void)applicationWillResignActive:(UIApplication *)application
{
timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(triggerTimer:) userInfo:nil repeats:FALSE];
NSRunLoop* runLoop = [NSRunLoop currentRunLoop];
[runLoop addTimer:timer forMode:NSRunLoopCommonModes];
[runLoop run];
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
if (timer && [timer isValid]) {
[timer invalidate];
}
}
My problem is that if I invalidate the timer the runloop is still running and freezing my UI (animations not working, scrolling not working, etc). Any ideas how could i accomplish this?
Thanks in advance!