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

查看:17
本文介绍了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天全站免登陆