Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1012173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:54:23+00:00 2026-05-16T09:54:23+00:00

I have a tabbar-based app with three tabs, one of them is a running

  • 0

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?

  1. 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 use addTimer:forMode: and invalidate?
  2. If the ladder, how often should I add and invalidate the timer? In my viewWillAppear and viewWillDisappear methods for the rootview controller of the clock tab? Somewhere else?

Thanks so much in advance for your wisdom!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T09:54:24+00:00Added an answer on May 16, 2026 at 9:54 am

    I would do the following:

    if your Clock-View appears -> set the Clock to the current time, then start a timer that updates the clock every second:

    clockRefreshTimer = [NSTimer scheduledTimerWithTimeInterval: 1 target: self selector:@selector(updateClockView) userInfo:nil repeats:YES]
    

    if the clock view is about to disappear invalidate the timer

    [clockRefreshTimer invalidate];
    

    This way you don’t do unnecessary updates.

    hope I could help,
    sam

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tabbar based app and would like to reference one of three
I have a TabBar app with one of its tabs embedded in a NavigationController.
I have a tabbar application that has one screen that displays statistics based on
I have a tabbar-based iOS app with two tabs. When I tab into the
I am doing an app based on tabbarController. I have a 3 tabbar items.
I have a tabBar App, with 5 tabs. The application was built in previous
I have two tabbar items(views) that use the same data, whats the best solution
I have an TabBar app that I would like to be in landscape and
I have a tabbar based app. In the app delegate, I've implemented: - (void)tabBarController:(UITabBarController
I have an iPhone app based on a tabBar and tableViews. I want the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.