NSTimer Protocol Hold Time

Discussion in 'iOS Programming' started by hharbers, Jul 18, 2011.

  1. hharbers macrumors newbie

    Jul 18, 2011
    Hey guys,
    Stop me if you've heard this one before...

    -I have a timer application whose protocol needs a upcount (1,2,3...) terminate parameter of 180s.
    -On pressing the Start/Stop button, the paused integer must rest for 10 seconds before a count down (3,2,1) begins at 50 seconds (10+50=Clever girl...).
    -Any time during this countdown, the Start/Stop button can be pressed resuming at the time of the initial pause.
    -The amount of cycles is then recorded as a UILabel in the corner as well as in a local storage on the phone (I wish to post this data after beta in a PHP server).

    I already have this beast out in a Java environment, but the NSTimer and NSDate actions are foreign to me. Yes, I've looked up this matter on the developer pages. No, I don't understand them entirely.

    Any advice from the sages at Mac Rumors?
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Don't expect magic, because there isn't any. You're going to have to study it. And practice, practice, practice.

    Read the class references, look at the sample code linked to from the class references, and try simpler examples first. For example, I wouldn't try your described project immediately. Try a simple count-up timer first. That's it: just count up. Then try a simple count-down timer that stops at 0. Then try some simple examples using NSDate.
  3. hharbers thread starter macrumors newbie

    Jul 18, 2011
    Knee Deep in delicious code.

    I'm practicing my arse off for the sake of this damnable program. So far, I've decided to do the practical thing and redo the "Hello World" documentation from the Apple site. Of course, they've gone XCode4 as I've humbly been programming in 3.

    Fortunately, I've learned much more about class, MVC and all that jive than when I posted before. Fundamentals first, specifics second IMO.

    I've also narrowly avoided jumping head over heels into NSUserDefault and instead had my eyes opened to the iOS Keychain. Celebrations were had by all.

    My question still stands however, how to I dick around with the substance of my O.P? I'm having issues creating a single timer which can count up, then down. I can easily terminate at my designated 180 endpoint and my audio warning is being handled by the AVFoundation/AVPlayer because I saw it on a little kid's youtube tutorial. My goal for the night is to implement a button that can turn the count up into a count down from 50, then, baby, I got a stew goin'.

    I may be biting more than I can chew, but I've found that I learn better when I parallel between the philosophy and the semantix of coding. Hopefully I'll rock a sweet app in the coming days.

    Also found myself a tutor, which is the ****. I'm looking forward to understanding this board in the future.

Share This Page