Ios time timer NSTimer application demo

Source: Internet
Author: User

Demo function: ios NSTimer application demo. Iphone6.1 passed the test.

Demo Description: The time timer NSTimer in ios is used to complete the scheduled function of the program. He needs three main parameters: the time interval NSTimeInterval floating point type, event proxy delegate and event processing method @ selector (); in this example, nstate is used to cancel a program pop-up dialog box.

Demo screenshot:

 

 


Demo main code:


 

<STRONG xmlns = "http://www.w3.org/1999/xhtml">-(void) handle mdismiss: (NSTimer *) timer {// the processing method of the timer call to hide the prompt box [baseAlert dismissWithClickedButtonIndex: 0 animated: NO]; [baseAlert release]; baseAlert = NULL;}-(void) presentSheet {// defines the prompt Box Information baseAlert = [[UIAlertView alloc] initWithTitle: @ "Alert" message: @ "\ nMessage to user with asynchronous information" delegate: self cancelButtonTitle: nil otherButtonTitles: nil]; // initialize a timer. The three main parameters are interval NSTimeInterval floating point type, event proxy delegate and event handling method @ selector () [NSTimer scheduledTimerWithTimeInterval: 3.0f target: self selector: @ selector (effecmdismiss :) userInfo: nil repeats: NO]; // display the prompt box [baseAlert show] ;}</STRONG>

 

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.