1

我想在执行后台线程时使用某种形式的加载显示。我曾考虑过使用 anActivity Indicator view但我觉得它本身还不够。我希望能够在加载过程中阻止用户交互,因此我考虑将它托管在 UIAlertView 上。但是我看到 Apple 声明你The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.因此我犹豫是否将加载指示器放入 UIAlertView。

我在这里查看了其他示例,其中一些建议了该Custom UIAlertView方法。我只是想知道最好的方法或方向是什么?

如果我自定义 UIAlertView,我认为应用程序将被拒绝是正确的吗?

谢谢

4

5 回答 5

2

使用 MBProgressHUD,它会在后台线程中完成工作时显示带有指示器和/或标签的半透明 HUD。MBPreogressHUD,请参阅示例以获取更多详细信息

于 2013-11-11T11:01:00.450 回答
0

我做过这样的事情。我所做的是使用半透明的黑色视图覆盖整个窗口。捕获此叠加层中的任何事件,以防止单击下面的组件。这是可以接受的,该应用程序在 App Store 中。

于 2013-11-11T11:00:49.883 回答
0

看看 MBProgressHUD - 正是为此而构建的 - https://github.com/jdg/MBProgressHUD

于 2013-11-11T11:01:08.993 回答
0

您可以使用 MBProgressHUD 标准库。从此链接下载

很快你就可以这样做了:

[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[MBProgressHUD hideHUDForView:self.view animated:YES];

这个MBProgressHUD 链接将帮助您理解它

于 2013-11-11T11:02:17.270 回答
0
  1. Create notification and fire it back to the main thread in callout block of asynchronous thread.
  2. Create new special Activity View Controller with translucent self.view and add UIActivityView on it. Trap UIEvents on customized view and set it as self.view.
  3. Add this controller as listener to notification.
  4. When asynchronous process starts, add this view controller as child controller to existing controller, same with the self.view.
  5. When notification reached Activity View Controller notification triggered method, remove its view from superview, same with view controller, t.i. Activity View Controller.

In this way you will be more flexible to do anything you want with it.

于 2013-11-11T11:26:05.037 回答