ios - Adding time to NSTimer -
i'm creating ios test game practice , want game on method ran @ end of 15 second timer.
i want time added timer , taken away if actions take place.
not having luck figuring out how add time or take away time timer depending on actions user.
so far have timer in viewdidload
, method conditional formatting things depending on user does.
once has been created, period of nstimer
cannot changed, timer can cancelled or allowed fire after requested period.
in order implement timer game suggest set repeating timer fires every second. actual 'time remaining' value stored in integer , decrement value each time timer fires. when value reaches 0, end game.
this way can add additional time changing value of time remaining variable.
this approach makes simple display remaining time on screen.
Comments
Post a Comment