I don’t know why, but the statistics of this blog says that there are lots lof people who have interest in sleep function in Cocoa. Probably a same guy keeps visiting my blog for this.
Well, I don’t know what is so special about sleep.
Mac OS X is UNIX. So, you can use any standard library functions like sleep(), usleep() and nanosleep(). Also, NSThread provides Cocoa-level sleep facility.
- + (void)sleepForTimeInterval:(NSTimeInterval)ti
- + (void)sleepUntilDate:(NSDate *)aDate
Entire (RSS)
Posted by Alexander Jäger on October 12, 2009 at 11:33 am
iPhone sleep usleep sleepForTimeInterval NSTimer…
3 Möglichkeiten eine iPhone Anwendung zu pausieren:
[NSThread sleepForTimeInterval:5];
sleep(5);
usleep(5000000);
Alle 3 Anweisungen bewirken das gleiche Ergebniss, die Anwenudng wird schlafen gelegt. nachteil aller Optionen: die Anwendung wird wirklic…