NSTimer

守給你的承諾、 提交于 2019-11-26 10:14:56
NSTimer是Cocoa中比较常用的定时器类,基本操作如下:
handleTimer方法可以自行定义。在需要的地方创建timer即可,handleTimer就可以每0.5秒执行一次。
 
- (void) handleTimer: (NSTimer *) timer
{
   //在这里进行处理
}
 
NSTimer *timer;
 
timer = [NSTimer scheduledTimerWithTimeInterval: 0.5
                                                                 target: self
                                                                 selector: @selector(handleTimer:)
                                                                 userInfo: nil
                                                                 repeats: YES];

转载于:https://www.cnblogs.com/mac_arthur/archive/2010/04/09/1708328.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!