I develop a method where each 3 seconds I show a image moving. I make with dispatch_after, but in each execution of the app, the distance or the time when the image is shown it's diferent. Is more efficient use an NSTimer with a Schedule??
Asked
Active
Viewed 962 times
2 Answers
2
Yes, NSTimer is high level API and easy to implement and control like if you want to pause or stop that animation you can do it. But GCD is better in performance as I know.

Retro
- 3,985
- 2
- 17
- 41
2
I think for a repeating time period NSTimer is the more obvious choice. Apart from anything else you need to make sure that one and exactly one dispatch_after is called for each time you get called.
With a dispatch_after chain there may be a risk that there will be a slight drift in timing as delays add up where with the NSTimer if one event is slightly late there should be a fractionally shorter delay to the next one so that it doesn't suffer drift over time.

Joseph Lord
- 6,446
- 1
- 28
- 32