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

  • SEARCH
  • Home
  • 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 7737807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:06:00+00:00 2026-06-01T08:06:00+00:00

I need to start NSTimer by 0:0:0 that I am doing and I have

  • 0

I need to start NSTimer by 0:0:0 that I am doing and I have a Pause button on click of that the timer has to pause after some time if a user clicks play it has to run from paused value of time. How can I pause and play in NSTimer?
Any help? Thanks in advance.

  • 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-01T08:06:01+00:00Added an answer on June 1, 2026 at 8:06 am

    Try this shizzle… worked great for me

    EDIT

    To be honest my actual code is this:

    -(IBAction)clicked:(id)sender
    {
        if ([startStop.titleLabel.text isEqualToString:@"Start"]) 
        {
            [startStop setTitle:@"Pause" forState:UIControlStateNormal];
            [startStop setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    
            timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countUp) userInfo:nil repeats:YES];
            timerDown = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countDown) userInfo:nil repeats:YES];
    
        } else if ([startStop.titleLabel.text isEqualToString:@"Pause"])
        {
            [startStop setTitle:@"Resume" forState:UIControlStateNormal];
            [startStop setTitleColor:[UIColor colorWithRed:0/255 green:0/255 blue:255/255 alpha:1.0] forState:UIControlStateNormal];
    
            pauseStart = [[NSDate dateWithTimeIntervalSinceNow:0] retain];
            previousFireDate = [[timer fireDate] retain];
            [timer setFireDate:[NSDate distantFuture]];
    
        } else if ([startStop.titleLabel.text isEqualToString:@"Resume"])
        {
            [startStop setTitle:@"Pause" forState:UIControlStateNormal];
            [startStop setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    
            float pauseTime = -1*[pauseStart timeIntervalSinceNow];
            [timer setFireDate:[NSDate dateWithTimeInterval:pauseTime sinceDate:previousFireDate]];
            [pauseStart release];
            [previousFireDate release];
        }
    }
    

    I used a UIButton and used this code when clicked.

    remember to put this:

    NSDate *pauseStart, *previousFireDate;
    

    in your .h file

    EDIT!

    here is the countUp method. forget the down method. seconds, minutes, hours are Ints

    - (void)countUp
    {
        seconds += 1;
    
        if (seconds == 60) 
        {
            seconds = 0;
            minutes++;
    
            if (minutes == 60) 
            {
                minutes = 0;
                hours++;
            }
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to start a program every time the user logs in, but I
I need to start 1-3 external programs in my Java application that have paths
I need to start external executable in such way that user can interact with
I need to start a program from Windows Service. That program is a user
I need to start writing some MSMQ code that will interface with WCF code
I need to start processing a URL that will contain some emailand a GUID.
I need to start a project that will be json-API-centric, which means that most
I want to (need to) start a sub-process from a perl script that checks
I need to start a CPU-intensive system process under low priority so that it
I am using Titanium Studio. I need start 5 digit after point in float

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.