I have a tabbar-based app with three tabs, one of them is a running clock. To animate the clock UI, I use an NSTimer that fires once a second. If the user will be switching in and out of the various tabs, how should I manage this timer?
- Can I just use
scheduledTimerWithTimeInterval
to create and schedule the timer when the app is first run and let it die when the app closes? Or should I maintain an instance variable for the timer in the rootview controller for the clock tab and useaddTimer:forMode:
andinvalidate
? - If the ladder, how often should I add and invalidate the timer? In my
viewWillAppear
andviewWillDisappear
methods for the rootview controller of the clock tab? Somewhere else?
Thanks so much in advance for your wisdom!