If I try and click on another link before the page is finished loading, didFailLoadWithError: fires and unhides a connection issue image that I hid. Here is the code I'm using:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSLog(@"didFinish: %@; stillLoading:%@", [[webView request]URL],
(webView.loading?@"NO":@"YES"));
}
-(void)webView:(UIWebView *)myWebView didFailLoadWithError:(NSError *)error {
NSLog(@"No internet connection");
_connectionError.hidden = NO;
}
Does anyone know of a quick way to have it only run once on the apps startup and never run again for the remainder of the time?
This is a delegate method that is fired everytime it fails..
try something like this. (create a BOOL named firstTimeRun in header)
Remember to set firstTimeRun to NO when site is loaded if you only want this on the first load.
EDIT:
In your Header file (.h) you write the following
you might need to initialise it with NO somewhere in your method. You need to post your .h and .m files of the class before I can help you more.