我希望能够设置一个计时器来计时 23 秒,然后执行一个功能。我怎么能这样做呢?我需要 NSTimer 吗?
最佳答案
直接使用
[NSTimer scheduledTimerWithTimeInterval:23.0 target:self selector:@selector(myThingToDo) options:nil];
手机打字,先测试一下。
此外,还有一个neat category允许您将 NSTimer 与 Blocks 一起使用!
关于iphone - 如何安排一个方法在延迟后运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16776700/