为什么当放置在 appDidFinishLaunching 中时不会重复?
self.ti = [NSTimer timerWithTimeInterval:10. target:self selector:@selector(bounce:) userInfo:nil repeats:YES];
[self.ti fire];
非常感谢
Jules
我认为你的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];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)