首页 > 其他 > 详细

nstimer注意事项

时间:2017-05-12 12:10:48      阅读:294      评论:0      收藏:0      [点我收藏+]

当nstimer在主线程创建时,当滑动时,系统为了更好的处理UI事件,会暂停timer,解决办法就是改变timer的mode,不使用缺省的NSDefaultRunLoopMode,而是改用NSRunLoopCommonModes

NSTimer *timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(timer:) userInfo:nil repeats:YES];

[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

nstimer注意事项

原文:http://www.cnblogs.com/liuting-1204/p/6844916.html

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