ios - 将 UIActivityIndi​​catorView 添加到 UIAlertView

标签 ios objective-c uialertview uiactivityindicatorview

我想在消息中添加一个事件指示器,即 uiAlert 消息,我基本上尝试了互联网上的所有内容,但没有任何效果,我只需要 uialertview,这是我的代码

UIAlertView  *waitAlert = [[UIAlertView alloc] initWithTitle:@"Please Wait...." message:@"\n\n" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame: CGRectMake(125, 50, 30, 30)];
progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
progress.color = [UIColor blackColor];
[waitAlert addSubview: progress];
[progress startAnimating];
[waitAlert show];

这就是我最终得到的
enter image description here

我错过了什么!?

最佳答案

在 iOS 7 中你不能在 UIAlertView 上添加 subview ,直到 iOS 6.1 才有可能。所以 MBProgressHud 是最好和简单的解决方案

关于ios - 将 UIActivityIndi​​catorView 添加到 UIAlertView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23079967/

相关文章:

iphone - 另一个 NSInternalInconsistencyException,但使用 NSFetchedResultsController

ios - 即使用户拒绝从 App 访问 Twitter,也会出现 Twitter 登录页面

iphone - 警报 View - 如何使用 clickedButtonAtIndex :

ios - UIAlertView clickedButtonAtIndex 方法未被调用

ios - 如何在自定义 TableViewCell 中的 UIView Tap 上禁用 didSelectRowAtIndexPath?

iphone - 如何获取有关 iPhone 中播放的音乐轨道的信息?

ios - Swift - MKPointAnnotation 自定义图钉图像

iphone - 如何在其他标签更改时更改标签?

objective-c - 访问预处理器宏定义的值

iphone - 将 UISwitch 更改为打开