Reputation: 3071
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
self.theTimer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(timerFire:) userInfo:nil repeats:NO];
//if(timerFire not called) {other code}
}
How can I detect if timerFire:
not called. If timerFire:
is not called then I want to perform some other activity.
Upvotes: 0
Views: 117
Reputation: 5183
try this
if ([self respondsToSelector:@selector(timerFire:)])
{
// Your Code
}
else
{
}
Upvotes: 0
Reputation: 22731
It's not quite clear what you're asking here.
In any normal situation the timer is going to fire and thus timerFire:
will be called.
This will not happen if:
you did not actually implement timerFire:
in the class which you set as a target (so, in this case it's self
). you can check this with respondsToSelector:
?
the timer is invalidated before the interval of 0.2 sec is over, in that case you can use a global variable in your class (something like BOOL timerDidFire
) and set it to YES
in timerFire:
Upvotes: 1