appDidFinishLaunchingに配置したときに、これが繰り返されないのはなぜですか?
self.ti = [NSTimer timerWithTimeInterval:10. target:self selector:@selector(bounce:) userInfo:nil repeats:YES];
[self.ti fire];
どうもありがとう
ジュール
それが役立つかどうかはわかりませんが、scheduledTimerWithTimeInterval
メソッドを使用してみてください。例:
self.ti = [NSTimer scheduledTimerWithTimeInterval:10. target:self selector:@selector(bounce) userInfo:nil repeats:YES];
それが役に立てば幸い
bounce
あなたの署名は間違っていると思います。そのはず
- (void)bounce:(NSTimer*)theTimer {
NSLog(@"Here...");
}
selector(bounce:)
このメソッドのスケジュールにはを使用する必要があります。scheduledTimerWithTimeInterval
また、次の代わりに呼び出す必要がありますtimerWithTimeInterval
:
self.ti = [NSTimer
scheduledTimerWithTimeInterval:10.
target:self
selector:@selector(bounce:)
userInfo:nil
repeats:YES];