iPhone 开发 - 限制用户与应用程序的交互并显示进度指示器

发布于 2024-07-11 12:20:27 字数 270 浏览 5 评论 0原文

我有一个案例,我从服务器获取信息。 我的应用程序有一个选项卡栏和导航按钮。 我希望应用程序显示进度指示器并禁用所有其他控件,以便用户在从服务器提取数据时无法跳转。 我怎样才能做到这一点?

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

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

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.

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.

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

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

发布评论

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

评论(2

过期情话 2024-07-18 12:20:27

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

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

谢谢。

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.

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).

Thanks.

伴我老 2024-07-18 12:20:27

只需创建一个没有按钮的 UIAlertView,它将阻止任何用户交互。

如果需要,您可以将 UIProgressView 或 UIActivityIndi​​catorView 添加到警报中。

Just create an UIAlertView with no buttons, it will prevent any user interaction.

You can add an UIProgressView or UIActivityIndicatorView to your alert if you want.

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