Hi Guys,

I am new to iPhone programming so am hoping someone can help me out here. I have searched the web, but can only find information on count down timers.

What I am looking to do is start a count up timer when a button is pressed and then stop it when a certain value drops by, say 5, and finally display that time. I can display values on screen once I have them, but getting the time in the first place is proving difficult for me.

I apologize if this is a simple question, but I look forward to reading your responses.

Thanks in advance, stu


There's no difference between an up-counter and down-counter. Just change the order of your subtraction.

UpcounterElapsedTime = UpcounterCurrentTime - UpcounterStartTime;
DowncounterElapsedTime = DownCounterStartTime - DownCounterCurrentTime;
Carl Norum
Thanks a lot, I shall give that a go!
Stuart Forbes

NSDate will provide the current date. You can use - (NSTimeInterval)timeIntervalSinceNow to get the time since the first call and now.

Thank you Zaph, but could you maybe help me further by explaining how I could apply this method to my specific problem, Thanks stu
Stuart Forbes
I need to know more about exactly you are trying to accomplish, how you are using time.
For a specific time in the future ypou can use NSTimer timerWithTimeInterval:target:selector:userInfo:repeats