why would this not repeat when place in appDidFinishLaunching?
self.ti = [NSTimer timerWithTimeInterval:10. target:self selector:@selector(bounce:) userInfo:nil repeats:YES];
[self.ti fire];
many thanks
Jules
I think your bounce
has a wrong signature. It should be
- (void)bounce:(NSTimer*)theTimer {
NSLog(@"Here...");
}
You should be using selector(bounce:)
to schedule this method. You should also be calling scheduledTimerWithTimeInterval
instead of timerWithTimeInterval
:
self.ti = [NSTimer
scheduledTimerWithTimeInterval:10.
target:self
selector:@selector(bounce:)
userInfo:nil
repeats:YES];
I'm not sure if it will help, but try using scheduledTimerWithTimeInterval
method. An example:
self.ti = [NSTimer scheduledTimerWithTimeInterval:10. target:self selector:@selector(bounce) userInfo:nil repeats:YES];
Hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.