Page 1 of 1

iPhone Programming - NSTimer Gotcha's

Posted: Sun 27 Dec, 2009 10:53 pm
by PISD Support
A few warnings about using NSTimer's within iPhone programs.

The first thing which isn't apparently obvious is that while you are allowed to call code which appears to change the frequency of a timers callback (ie. to make it faster or slower) this code will have NO effect within the program.

The second thing to consider is that you have to ensure you 'invalidate' a timer to stop it from triggering, simply setting it to 'nil' is not enough.

Code: Select all

	[self._timer invalidate];
	self._timer = nil;