24/7 twenty-four seven

iOS/OS X application programing topics.

スクロール(ドラッグ)中でもタイマーを止めない方法

NSTimerのカウントがUIScrollViewのドラッグ中に止まってしまうのが困る場合は次のようにします。

NSTimer *timer = [NSTimer timerWithTimeInterval:1.0f target:self selector:@selector(onUpdate:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];