I have a simple app with a button, UIImageView and a NSTimer. The timer is fired up every 5 seconds repeatedly to update the ImageView with a new image, while the button simply stops the timer and switches to another View.
The problem is that when I press the button, nothing happens for a few seconds (until the timer fires up again).
Is there a way to cause the button to stop the timer and do its job at any given time instead of between intervals of the timer?
The button is defined in the InterfaceBuilder and connected to a function in the code.
The NSTimer code: (I've tried with & without adding it to the RunLoop).
updateTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(updateImageViews) userInfo:nil repeats:YES];
NSRunLoop* runLoop = [NSRunLoop currentRunLoop];
[[NSRunLoop currentRunLoop] addTimer:updateTimer forMode:NSDefaultRunLoopMode];
[runLoop run];
Thanks!