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

The Archive Base Latest Questions

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

Iam using xCode 4.3.2, In my count-down timer project (code showing below), i want

  • 0

Iam using xCode 4.3.2, In my count-down timer project (code showing below), i want to stop the count-down after 30 seconds. How can i set this limit for my count-down?
Could you please help me?

int countLimit=30; //seconds
NSDate *startDate;

- (void)countDown{
    NSDate *currentDate = [NSDate date];
    NSTimeInterval timeInterval = -([currentDate timeIntervalSinceDate:startDate]);
    NSDate *timerDate = [NSDate dateWithTimeIntervalSince1970:timeInterval];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"HH:mm:ss"];
    [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0.0]];
    NSString *timeString=[dateFormatter stringFromDate:timerDate];
    self.myCounterLabel.text = timeString;
    [dateFormatter release];
}

- (void)updateCounter{

    self.myCounterLabel.text = @"00:00:00";
    startDate = [[NSDate date]retain];

    myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/10.0
    target:self
    selector:@selector(countDown)
    userInfo:nil
    repeats:YES];
}
  • 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-01T19:03:46+00:00Added an answer on June 1, 2026 at 7:03 pm

    Just add to your countDown

    if([[NSDate date] timeIntervalSinceDate:startDate]>=countLimit)
    
    [myTimer invalidate];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using xCode 4.3.1. After i created a project, i build it and
I am using Xcode. I have implemented the shake code. Now I want to
i want to run project in xcode but i can not get input from
I am using XCode 4.3.2 and trying to open an already existing project based
I am using Xcode and, after some struggling, it is compiling my dynamic libraries
Using XCode 4.2, I am using the static analyser on code similar to the
I am using xcode 2.4.1 on tiger. When i do below everything is ok.
I am using xcode (3.2.3) for an iPhone project that I have checked out
I am using XCode 4.0.2 for a iOS4 project. I have this class method
Using the following code I am always getting category.subCategories count to be 0 using

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.