What are some of the better/best ways of implementing a countdown timer in iOS?
I've done some digging and tried using NSTimers (1 sec timer) but some people suggest that's not a good way because its not very accurate!!! Others claim it wastes battery, since its always going to be on in the background till the time elapses. I was thinking I could create a multiple scheduled NSTimer so it won't loose sync. Some suggest I should record the actual timestamp at the beginning and somehow make use of the built-in clock and use that to update the timer countdown.... except I can't seem to figure out how to do that. Any ideas? How are you implementing it?
Any time you are implementing a timer, the best option is always to record your start time. Then, whenever you update your interface, simply take the difference of the current time and your start time. You can then use NSTimers to trigger updates of the interface at certain periods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With