首页 > 其他 > 详细

iOS中的定时器 - NSTimer 使用方法

时间:2014-02-20 13:22:39      阅读:283      评论:0      收藏:0      [点我收藏+]

我的技术博客经常被流氓网站恶意爬取转载。请移步原文:http://www.cnblogs.com/hamhog/p/3556805.html,享受整齐的排版、有效的链接、正确的代码缩进、更好的阅读体验。

【初始化】

//参数 timeInterval 为 double 类型,单位为秒;每次到时间时,触发回调函数selector
myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(someFunction) userInfo:nil repeats:YES];
[myTimer setFireDate:[NSDate distantFuture]];

【开始计时】

[myTimer setFireDate:[NSDate date]];

【暂停计时】

[myTimer setFireDate:[NSDate distantFuture]];

iOS中的定时器 - NSTimer 使用方法

原文:http://www.cnblogs.com/hamhog/p/3556805.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!