I'd like to animate some loading points while the app is doing some computation in the background. I achieve this via an NSTimer
:
self.timer = [NSTimer scheduledTimerWithTimeInterval:0.3f
target:self
selector:@selector(updateLoadingPoints:)
userInfo:nil
repeats:YES];
Unfortunately, sometimes, when the computation becomes pretty heavy, the method is not fired and the updating therefore doesn't happen. It seems like all the firing is in a queue which is fired after the heavy computation.
Is there a way to give the NSTimer
a higher priority to ensure that it's regularly calling my method? Or is there another way to achieve this?
Make your timer call from a separate thread rather than from main thread. this will certainly keep it separate from your other main thread's processing which will give you desired results.