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 8157373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:15:44+00:00 2026-06-06T17:15:44+00:00

I have a timer which will be initialized on viewDidLoad, and be released on

  • 0

I have a timer which will be initialized on viewDidLoad, and be released on viewDidUnload, but I found the viewDidUnload nerver be called and each time the view is presented to user the viewDidLoad is called, so I have many timers running simultaneously… which is not what I want.

I just want to stop&release the timer when user navigate away from this view, how can I do that?

  • 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-06-06T17:15:45+00:00Added an answer on June 6, 2026 at 5:15 pm

    Don’t initialize it on view did load, instead initialize it in view will apper and stop it in view will dissapear, that way it will stop when you navigate away and restart once you come back to that view.

    I had the exact same problem you are having. This is the code just in case you need it:

    - (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    NSLog(@"View will appear");
    myTimer = [NSTimer timerWithTimeInterval:5.0 target:self selector:@selector(pageCycler) userInfo:nil repeats:YES];
    [[NSRunLoop mainRunLoop] addTimer: myTimer forMode: NSDefaultRunLoopMode];
    }
    
    - (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    NSLog(@"View will dissapear");
    [myTimer invalidate];
    myTimer=nil;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a static timer class which will be called by ANY webpage to
I need to have a DateTimePicker which will be able to select the Time
I have a silverlight application which users will be running in various time zones
I have a HashMap called examList which stored exam grades of each course a
I have a loop MC which will be duplicate to stage several times according
How can i have timer which runs for every 5 secs continously. below is
I have a timer which calls the below code to reload a cell in
I have a Timer which kicks off and does it's job indefinitely in it's
I have a timer in my JavaScript which needs to emulate clicking a link
I have a Windows Service application which uses a Threading.Timer and a TimerCallback to

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.