本文介绍了UIActivityIndi​​catorView不在UIAlertView中显示 - iOS7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

加载时我需要在 UIAlertView 中 UIActivityIndi​​catorView 。但是当我添加中显示。这在iOS 6&最低版本。以下是我的代码。

I need to UIActivityIndicatorView in UIAlertView when loading. But UIActivityIndicatorView is not displaying when I add this with UIActivityIndicatorView not displaying in UIAlertView - iOS7 in iOS 7. And this is working good in iOS 6 & lowest versions. Below is my code.

有什么解决方案吗? 。谢谢。

Is there any solution ? . thanks.

UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:@"\n\n\n\nloading.." delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alertView show];

UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
activityIndicator.frame= CGRectMake(50, 10, 37, 37);
activityIndicator.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin;

[alertView addSubview:activityIndicator];

[activityIndicator startAnimating];


推荐答案

Apple弃用 addSubview 时的code>方法。所以你不能再向AlertView添加任何子视图,例如:活动指示器或一些进度条。

Apple deprecated addSubview method in case of UIAlertView. So you can't add any subviews any more to AlertView, for example : activity indicator or some progress bar.

在这里你可以查看我的问题,人们在哪里共享自定义警报这将支持添加控件

Here you can look at my question where people share custom Alerts which will support adding controls

这篇关于UIActivityIndi​​catorView不在UIAlertView中显示 - iOS7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 08:23