1. latency functions:
[Nsthread sleepfortimeinterval: 5.0]; // pause for 5 s.
2. Use of Timer:
Nstimer * connectiontimer; // timer object
For example:
// Initialize timer, @ selector (logo :), itsMediumThe method is automatically called after the past 1.5 seconds..
Self. connectiontimer = [nstimerscheduledtimerwithtimeinterval: 1.5 target: selfselector: @ selector (timerfired :) userinfo: Nil repeats: No];
[[Nsunloop currentrunloop] addtimer: Self. connectiontimer formode: nsdefaultrunloopmode];
// Use timer as a delay Method
Do {
[[Nsunloopcurrentrunloop] rununtildate: [nsdatewithtimeintervalsincenow: 1.0];
} While (! Done );
// Call the function by timer
-(Void) timerfired :( nstimer *) timer {
[Logo. View removefromsuperview];
[Timer invalidate];
// This sentenceCodeIt is used to terminate Timmer. Otherwise, this method will be executed once every 1.5 seconds. It is enough to be executed once at the beginning.
}
3. Execute the timecount method every 0.8 seconds.
Nstimer * counttimer;
Counttimer = [nstimerscheduledtimerwithtimeinterval: 0.8 target: selfselector: @ selector (timecount :) userinfo: nilrepeats: Yes];
[Counttimerfire];// Execute Timer
4. the test method is executed with a delay of 1 second:
[Selfperformselector: @ selector (TEST) withobject: nilafterdelay: 0.1];