网络活动指示器应该始终处于活动状态吗?

发布于 2024-12-21 13:13:50 字数 248 浏览 2 评论 0原文

我正在 iphone 项目中使用网络活动指示器。问题是,即使我的应用程序中没有发送和接收,指示器也会旋转,并且仅在网络断开连接时停止。

任何人都可以告诉它是因为任何隐藏的活动或网络活动指示器行为都是这样的!对于这个问题你有什么解决办法吗?

我需要通知我的用户有关网络活动的信息...

编辑:问题是我不确定网络活动指示器的使用情况,或者换句话说,我不知道网络活动何时旋转,这是否意味着存在活动或只是显示连接未断开!

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

风追烟花雨 2024-12-28 13:13:50

网络活动指示器可以这样隐藏:

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

The network activity indicator can be hidden like that:

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
一百个冬季 2024-12-28 13:13:50

查看将活动设置为旋转的位置以及将其关闭的位置。您的呼叫似乎不平衡。

手动打开和关闭它的另一种方法是使用辅助类,例如 DCTNetworkActivityIndi​​catorController ,您可以在其中递增和递减调用微调器而不仅仅是打开和关闭它,这是显示活动的更可靠的方式。

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.

誰認得朕 2024-12-28 13:13:50

我从这个网站找到了这个问题的答案:
http://iosdevelopertips。 com/cocoa/showing-network-activity-when-there-isn%E2%80%99t-any.html

// 启动指标 ...
[UIApplication共享应用程序].networkActivityIndi​​catorVisible = YES;

// 做一些可能需要一些时间才能完成的事情...

// 停止指标...
[UIApplication共享应用程序].networkActivityIndi​​catorVisible = NO;

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;

葵雨 2024-12-28 13:13:50

如果您使用 UIWebView,您是否实现了

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

}

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

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];
}

?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文