After invalidate of NSTimer in iOS
Disclaimer: all original translated articles provided by this blog are from the Internet and are only for learning and communication purposes. Do not use them for commercial purposes. At the same time, do not remove this statement when reprinting. In the event of any dispute, it has nothing to do with the owner of this blog and the person who published the translation. Thank you for your cooperation!
Once a timer is created and added to a run loop, you can stop and release the timer through the invalidate instance method of the NSTimer class.
This will not only release the timer, but also release any objects passed to the timer during the timer lifetime, if any.
For example, the parameter userInfo In the instance method is passed to scheduledTimerWithTimeInterval: target: selector: userInfo: repeats.
If you pass NO to the repeats parameter, the timer will invalidate itself after the first transfer and call, and release all its objects (if any)