Hank22
Hank22

Reputation: 1

Change Interval from 5 seconds to specific time

timer =[NSTimer scheduledTimerWithTimeInterval:5.0 
                                        target:self 
                                      selector:@selector(onTimer) 
                                      userInfo:nil 
                                       repeats:YES];

Can I change the scheduledTimerWithTimeInterval to a specific time in the day? Without changing a lot of the code I already have?

Upvotes: 0

Views: 262

Answers (1)

Ole Begemann
Ole Begemann

Reputation: 135540

The documentation is your friend:

timer = [[[NSTimer alloc] initWithFireDate:myDate interval:5.0 target:self selector:@selector(onTimer) userInfo:nil repeats:YES] autorelease];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];

Upvotes: 3

Related Questions