Frage

I am using network activity indicator in an iphone project . the problem is even when there is no send and receive in my app the indicator is spinning and only stops when network is disconnected .

Can anyone tell is it because of any hidden activity or network activity indicator behavior is like this !!! Do you have any solution for this problem ?

I need to inform my user about network activity ....

EDIT : the problem is I am not sure about the usage of Network activity indicator, or in other word I dont know when the network activity is spinning , does it mean there is an activity or just it shows the connection is not down !

thanks

War es hilfreich?

Lösung 3

I Found the answer for this problem from this website : http://iosdevelopertips.com/cocoa/showing-network-activity-when-there-isn%E2%80%99t-any.html

// start the indicator ... [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

// Do something that may take some time to complete ...

// stop the indicator ... [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

Andere Tipps

The network activity indicator can be hidden like that:

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

Have a look at where you are setting the activity to spinning and where you are turning it off. It looks like you have unbalanced calls.

An alternative to manually turning it on and off is to use a helper class such as DCTNetworkActivityIndicatorController where you increment and decrement calls to the spinner instead of just turning it on and off, and this is a much more robust way of showing activity.

In case you use a UIWebView, did you implement

- (void)webViewDidFinishLoad:(UIWebView *)webView{
[(UIActivityIndicatorView *)[self navigationItem].rightBarButtonItem.customView stopAnimating];

}

and

- (void)webViewDidStartLoad:(UIWebView *)webView{
[(UIActivityIndicatorView *)[self navigationItem].rightBarButtonItem.customView startAnimating];
}

?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top