As the title suggests my activity indicator in the status wont stop animating.
Ive done some research on here and not sure what im doing wrong…
In my Apps delegate I have
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = NO;
In my view controller.m I want to call the activity indicator
NSString *web = @"http://google.com";
NSURL *url = [NSURL URLWithString:web];
NSURLRequest *requestUrl = [NSURLRequest requestWithURL:url];
[toweb loadRequest:requestUrl];
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES; <<<<<<<<<<<<<<<<<<<<<
Now heres the problem im trying to hide it again with:
- (void)DidFinishLoad:(UIWebView *)toweb{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
}
Any advice appreciated
looks like your
UIWebViewDelegatemethod name is wrong, it should benot
Hence when the
UIWebViewtries to call its delegate method, there is no method declaration so your class is not being notified that the web view has finished loading.Also make sure you have set your class as the delegate
toweb.delegate = selfand in your .h file
@interface viewcontroller : UIViewController <UIWebViewDelegate>Note that in the delegate callback method, the
webViewparameter is a reference to the webview that has finished loading (in this case its the one you’ve calledtoweb) This is a different pointer to the sameUIWebViewobject, so it doesn’t need to have the same name as your local declaration/handle to the web view