Hi
So, I am trying to run a method as soon (well, within 0.2 seconds off) a boolean value changing. I'm doing it with an IF function that only runs the first part if the BOOL is set to NO. If the BOOL is set to YES, it starts an NSTimer to run the same method again in 0.2 seconds. For some reason this doesn't work - I presume to prevent you calling the same method and entering a crash loop. My code it below, however I expect I will have to change it for some suitable alternative method. Can anybody suggest one of these? My code looks like this:
I'm sure there must be an alternative system for doing this. Can somebody point me in the direction of it please?
Thanks in advance,
Sam
So, I am trying to run a method as soon (well, within 0.2 seconds off) a boolean value changing. I'm doing it with an IF function that only runs the first part if the BOOL is set to NO. If the BOOL is set to YES, it starts an NSTimer to run the same method again in 0.2 seconds. For some reason this doesn't work - I presume to prevent you calling the same method and entering a crash loop. My code it below, however I expect I will have to change it for some suitable alternative method. Can anybody suggest one of these? My code looks like this:
Code:
-(void)checkForMessage {
if (alertCurrentlyShowing == NO) {
}
else if (alertCurrentlyShowing == YES) {
[NSTimer timerWithTimeInterval:0.2 target:self selector:@selector(checkForMessage) userInfo:nil repeats:NO];
}
}
I'm sure there must be an alternative system for doing this. Can somebody point me in the direction of it please?
Thanks in advance,
Sam