What's the equivalent of Java's Thread.sleep() in Objective-C/Cocoa?

后端 未结 6 442
野的像风
野的像风 2020-12-23 15:45

In Java you can suspend the current thread\'s execution for an amount of time using Thread.sleep(). Is there something like this in Objective-C?

6条回答
  •  盖世英雄少女心
    2020-12-23 16:18

    Yes, there's +[NSThread sleepForTimeInterval:]

    (Just so you know for future questions, Objective-C is the language itself; the library of objects (one of them at least) is Cocoa.)

提交回复
热议问题