优先考虑NSTimer

时间:2013-01-02 06:19:05

标签: objective-c ios nstimer

我正在运行NSTimer。该应用程序与NSTimer同时执行了很多操作(包括在相同的视图控制器和应用程序委托中)。我无法弄清楚原因,但有时NSTimer暂停并且不更新标签。 (它可以作为用户的各种秒表。)

我应该尝试用仪器解决这个问题吗?要在被中断时被调用的事物使用全局dispatch_async()?或者有没有办法优先考虑NSTimer及其调用的方法?

我正在创建这样的计时器:

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

[[NSRunLoop currentRunLoop] addTimer:oneSecondTicker forMode:UITrackingRunLoopMode]; //!important

0 个答案:

没有答案
相关问题