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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:20:36+00:00 2026-05-20T19:20:36+00:00

how to integrate countdown and alarm in xcode iphone? please provide source code….. i

  • 0

how to integrate countdown and alarm in xcode iphone? please provide source code…..
i have tried a lot…but didn’t find any specific solution…please help me…

  • 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-20T19:20:36+00:00Added an answer on May 20, 2026 at 7:20 pm

    A countdown would not be very hard to integrate, just use an NSTimer:

    NSTimer *countdown = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(timerTicked:) userInfo:nil repeats:YES]; 
    

    Simply countdown the timer for as many seconds as you want:

    - (void)timerTicked:(NSTimer *)countdown{
        seconds--; // Some pre-declared variable
    
        // UI Updates Here if you want
    
        if (seconds <= 0)
            [countdown invalidate]; 
    }
    

    An alarm would be a little more complicated, but still not too hard. There’s a few ways you could do it depending how you are setting the alarm. If it’s soon just use a timer:

    NSTimer *alarm = [NSTimer timerWithTimeInterval:SECONDS target:self selector:@selector(alarmDoneMethod) userInfo:nil repeats:NO];
    

    However I’m assuming for an alarm you want it to be able to be set hours or days in the future. In this case use an NSDate.

    NSDateComponents *alarmComponents = [[NSDateComponents alloc] init]; 
    [alarmComponents setMinute:userInputMinute];
    [alarmComponents setHour:userInputHour]; 
    [alarmComponents setDay:userInputDay];
    [alarmComponents setMonth:userInputMonth];
    [alarmComponents setYear:userInputYear];
    
    NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    
    NSDate *alarm = [gregorian dateFromComponents:alarmComponents];
    [alarmComponents release]; 
    

    Now just set a timer (I’m sure there is a more efficient way of doing this but I can’t think of it off the top of my head at the moment, it’s still early in the day) to check if your alarm has been reached:

    NSTimer *checkAlarm = [NSTimer timerWithTimeInterval:60.0 target:self selector:@selector(checkAlarm:) userInfo:nil repeats:YES]; // Checks every minute
    

    Then inside the checkAlarm: method just see if the alarm has been reached:

    -(void)checkAlarm:(NSTimer *)t{
        if ([[NSDate date] earlierDate:alarm] == alarm){
            // Alarm reached
            [t invalidate]; 
        }
    }
    

    Hope this helps.

    Cheers.

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

Sidebar

Related Questions

I have tried to integrate the Picasa API on iPhone, compiles fine, but I
I have been looking to switch to OAuth for my Twitter integration code and
I am trying to integrate facebook in my iphone application. after logged in from
I'm trying to integrate a WinForms Form inside a WPF XAML page. I have
I am working to integrate unit testing into the development process on the team
I'm trying to integrate running Fitnesse tests from MSBuild im my nightly build on
I'd like to integrate a Python IDLE-esque command prompt interface into an existing NI-CVI
I am looking to integrate Crystal Reports 2008 into a Windows Forms application. I
We are trying to integrate tests in our daily builds using TestComplete, so far
My goal is to integrate testing into my development environment (as post-build step). 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.