timer =[NSTimer scheduledTimerWithTimeInterval:5.0
target:self
selector:@selector(onTimer)
userInfo:nil
repeats:YES];
我可以将scheduledTimerWithTimeInterval更改为当天的特定时间吗?没有改变我已经拥有的很多代码?
答案 0 :(得分:3)
文档是你的朋友:
timer = [[[NSTimer alloc] initWithFireDate:myDate interval:5.0 target:self selector:@selector(onTimer) userInfo:nil repeats:YES] autorelease];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];