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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:17:42+00:00 2026-05-27T10:17:42+00:00

In my iPhone app I want to have a UILabel which counts down to

  • 0

In my iPhone app I want to have a UILabel which counts down to a certain date.

So far I have the user select a date from a UIDatePicker, but I can’t figure out how to actually logically countdown each unit of the date. It needs to be live as well, so you can watch the date change rather than having to reload the view and see the difference from now until then.

I want to have a format like so (might change it up later, not sure):
dd / mm / yyyy

  • 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-27T10:17:43+00:00Added an answer on May 27, 2026 at 10:17 am

    You will want an NSTimer to fire every time you wish to update the label and then you need to use NSDate‘s timeIntervalSinceNow method to get the time interval between your date and now. Then use that to update the label.

    For instance:

    - (void)startTimer {
        ...
        // Set the date you want to count from
        self.countdownDate = [NSDate date...]; ///< Get this however you need
    
        // Create a timer that fires every second repeatedly and save it in an ivar
        self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateLabel) userInfo:nil repeats:YES];
        ...
    }
    
    - (void)updateLabel {
        NSTimeInterval timeInterval = [self.countdownDate timeIntervalSinceNow]; ///< Assuming this is in the future for now.
    
        /**
         * Work out the number of days, months, years, hours, minutes, seconds from timeInterval.
         */
    
        self.countdownLabel.text = [NSString stringWithFormat:@"%@/%@/%@ %@:%@:%@", days, months, years, hours, minutes, seconds];
    }
    

    To get the actual number of days, months, years, hours, minutes & seconds you could also use NSCalendar and in particular the components:fromDate:toDate:options: method. Take a look at this question for some more discussion on that:
    Number of days between two NSDates

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

Sidebar

Related Questions

In my Iphone App I have created this query: SELECT * FROM visuel where
I want to have an iPhone app where the user can export the data
I have a tab-based iPhone app where I want to increase the perceived start-up
I have an application with some in-app purchase in IPhone. Now i want to
I want to create an iPhone app which makes calls to a web service.
In my iPhone app I want to have a UIPickerView with 2 components. Initially
I have a iPhone app and want to develop iPad app with the same
I have a simple iPhone app that Im learning and I want to have
My iPhone app will have read-only system data AND read/write user data (stored either
i have done iPhone app now i want to submit in app store i

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.