Search code examples
iphoneobjective-ciostimerinvalidation

(iphone) do I need to invalidate timer when repeats: no?


[NSTimer scheduledTimerWithTimeInterval: target: selector: userInfo: repeats:NO];

When repeats: is set to NO, do I need to invalidate the timer inside the specified selector?

Thank you

Edit

Another question, if it self invalidates,

How do you properly cancel a such timer?
Since invalidating already-invalidated timer would crash I assume?

maintain a pointer to the timer and set it to nil inside the selector that will get fired?


Solution

  • No, the timer will invalidate itself