After invalidate of NSTimer in iOS

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.