iPhone开发 - 限制用户与应用程序的交互并显示进度指示器 [英] iPhone Development - restrict user interaction with application and show a progress indicator

查看:115
本文介绍了iPhone开发 - 限制用户与应用程序的交互并显示进度指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从服务器提取信息的情况。我的应用程序有标签栏和导航按钮。我希望应用程序显示进度指示器并禁用所有其他控件,以便用户在从服务器提取数据时无法跳转。我怎样才能实现这个目标?

I have a case where i pull information from a server. My application has both a tab bar and navigation buttons. I want the application to show a progress indicator and disable all other controls so that user can't jump around while the data is being pulled from the server. How can i achieve this?

我想到的一种方法是显示带有进度窗口的透明视图(很像消息警报窗口 - 允许用户仅与消息警报窗口交互)。我需要帮助来实现这种方法。

One approach i have in mind is to show a transparent view with a progress window (much like the message alert window - which allows the user to interact with the message alert window only). I need help in implementing this approach.

目前,当从服务器中提取信息/数据时,我将UIActivityView添加到子视图并开始为其设置动画。但这并不限制用户导航到应用程序的其他部分。

Currently, when the information/data is being pulled from the server i add a UIActivityView to the subview and start animating it. But this does not restrict the user from navigating to other parts of the application.

推荐答案

Stephan建议将UIAlertView与UIProgressView一起使用或UIActivityIndi​​catorView。这个解决方案对我有用,但正如iPhone开发者社区的其他一些成员所讨论的那样,不推荐这种方法。

Stephan suggested the use of UIAlertView with UIProgressView or UIActivityIndicatorView. This solution worked for me, but as discussed with some of the other members of iPhone developer community, this approach is not recommended.

推荐的方法是使用新视图并将其透明度值设置为alpha 7或8,将其背景设置为黑色,并在此视图中添加UIProgressView或UIActivityIndi​​catorView,使用此新视图显示进度。使用这种技术不涉及黑客攻击。虽然,如果要将UIActivityIndi​​catorView添加到UIAlertView,您实际执行的是未记录的操作(不推荐)。

The recommended approach is to use a new view and set its transparancy value to alpha 7 or 8, set it's background to black, and add UIProgressView or UIActivityIndicatorView in this view and use this new view to show progress. No hack is involved in using this technique. While, incase of adding UIActivityIndicatorView to a UIAlertView, your actually performing a non-documented operation (which is not recommended).

谢谢。

这篇关于iPhone开发 - 限制用户与应用程序的交互并显示进度指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆