Hide activity indicator in status bar [duplicate]

2019-09-21 19:34发布

问题:

This question already has an answer here:

  • networkActivityIndicatorVisible 5 answers

I am using pull to refresh table and in pull to refresh table there is already a activity indicator. And when I pull the table then calling a web service then the activity indicator in status bar appears, but I want to hide the indicator in status bar in whole app. When I am connecting with webservice even then I don't want to show the network indicator. How can I do this?

I am using following code:

UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = NO;
[self connectserver];

Before connecting to server I am hiding the indicator but it's not working.

回答1:

you can call this method of activity indicator:

[app.networkActivityIndicator stopAnimating];

and if activity indicator is on superview the you have to remove it from superView:

[app.networkActivityIndicator removeFromSuperView];

Hope this might help.



回答2:

try this

    [UIApplication sharedApplication].networkActivityIndicatorVisible=FALSE;

and also check whether you make it visible somewhere else or not.