I have a NS Timer Firing within a web view load that looks for information on the page. I then do some manipulations to the page setting checkboxes etc which bring in some AJAX functions which as people may know does not fire the webviewloaded method. In short I would like to create a time that checks every 5 seconds to check to for a specific part that only occurs when the proper information is loaded. This is fine I can do this, but I don’t know how to stop the NSTIMER as all the examples here do not show a parameter being passed into the function.
currently I have
[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(fcheckForEditFinished) userInfo:nil repeats:YES];
-(void) fcheckForEditFinished
{
//Would like to kill timer at this point.
}
Thanks Kevin
The documentation of
scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:says this:And you can “kill” a timer by sending it the
invalidatemessage. So changefcheckForEditFinishedtofcheckForEditFinished:like this:The timer will automatically pass itself as the parameter of
fcheckForEditFinished:. Make sure you add the colon to the selector in your call toscheduledTimerWithTimeInterval:...too.