Multiple NSTimers slows down the Application

可紊 提交于 2019-12-02 14:46:24

问题


I am using multiple NStimers into my cocoa (MAC) application and i have added all of them in NSRunLoopCommonModes separately like below:

NSRunLoop *runloop = [NSRunLoop currentRunLoop];

 updateServerTimeTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateServerTime) userInfo:nil repeats:YES];

 [runloop addTimer:updateServerTimeTimer forMode:NSRunLoopCommonModes];

But after some time, my app. gets hung and also UI responds late. It is also slowing down my MAC, Can anyone provide a better approach to use multiple timers continuously within an application

来源:https://stackoverflow.com/questions/12907514/multiple-nstimers-slows-down-the-application

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