Can anybody say me how to save NSTimer ? I need to display that, at how much time player completed his/her game. please suggest.
Thanks.
Can anybody say me how to save NSTimer ? I need to display that, at how much time player completed his/her game. please suggest.
Thanks.
You don't need to use
NSTimer
. I suggest you usingNSDate
When the game starts:
when the game is over:
so now you have time spent and can use it however you like. You can save it in
NSUserDefaults
just like ordinarydouble
valueU should do some research before ask such questions, its easy to figure it out with google, it will take something like 20 min max,
and then u can recover it like that
but you need to make your timer Nsstring format firstly and then save it
you can do like this way..
int currentTime;
BOOL isGameOver;
Hope its help you all the best
NSTimer
is just a source of periodic time events, there’s not much to save. If you use it to keep track of time in your game, there has to be a variable that keeps the total time. Save that intoNSUserDefaults
or somewhere.