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…
how to integrate countdown and alarm in xcode iphone? please provide source code….. i
Share
A countdown would not be very hard to integrate, just use an NSTimer:
Simply countdown the timer for as many seconds as you want:
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:
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.
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:
Then inside the checkAlarm: method just see if the alarm has been reached:
Hope this helps.
Cheers.