How to pause and resume NSTimer in iphone?

You can't pause a timer. However, when the user goes to the settings view, you can save the fireDate of the timer and also the current date. After this you invalidate the timer and let the user do his/her stuff.

Once he/she switches back to the game, you create a new timer object and set the fire date to the old fire date plus the time the user was in the menu (oldTime + currentTime).

Thanks, But I am new to iphone. Can you provide me some demo sample so that I can easily go through it. – Hardik Patel Nov 11 '10 at 4:47.

You can't pause an NSTimer. You can, however invalidate it and create a new one when needed.

Thanks But I can't invalidate because when I go to another view and comes back then it should be start from where it is being stops. – Hardik Patel Nov 11 '10 at 4:42.

I have just made an category to pause and resume NSTimers. Check it out! Https://bitbucket.Org/charliefish/nstimer-extras/overview Charlie.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions