Ios UIActivityIndicatorView未显示在UIAlertView上
我试图添加一个带有一些信息文本的活动指示器来显示网络活动,在本例中是一个webservice调用。我的警报视图在web服务调用期间正确显示,但我无法在警报视图上显示活动指示器视图Ios UIActivityIndicatorView未显示在UIAlertView上,ios,objective-c,ios7,uialertview,uiactivityindicatorview,Ios,Objective C,Ios7,Uialertview,Uiactivityindicatorview,我试图添加一个带有一些信息文本的活动指示器来显示网络活动,在本例中是一个webservice调用。我的警报视图在web服务调用期间正确显示,但我无法在警报视图上显示活动指示器视图 -(void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; CGRect screenRect = [[UIScreen mainScreen] bounds]; NSString *loadingText = [N
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
CGRect screenRect = [[UIScreen mainScreen] bounds];
NSString *loadingText = [NSString stringWithFormat:@"Loading %@ gauges...", [self stateIdentifier]];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:loadingText delegate:self cancelButtonTitle: nil otherButtonTitles: nil];
alert.frame = CGRectMake(0,0,300,200);
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc]initWithFrame:
CGRectMake(roundf((screenRect.size.width - 50) / 2),
roundf((screenRect.size.height - 50) / 2),50,50)];
spinner.color = [UIColor blackColor];
[alert addSubview:spinner];
[self.tableView bringSubviewToFront:alert];
spinner.hidesWhenStopped = YES;
spinner.hidden = NO;
[spinner startAnimating];
[alert show];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
stateGauges = [[GaugeList alloc] initWithStateIdentifier:stateIdentifier andType:nil];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
[spinner stopAnimating];
[alert dismissWithClickedButtonIndex:-1 animated:YES];
});
});
}
有人能帮忙吗?谢谢 您需要在主线程中显示alertView和activityIndicator
dispatch_async(dispatch_get_main_queue(), ^{
[spinner startAnimating];
[alert show];
});
您需要在主线程中显示alertView和activityIndicator
dispatch_async(dispatch_get_main_queue(), ^{
[spinner startAnimating];
[alert show];
});
您需要在主线程中显示alertView和activityIndicator
dispatch_async(dispatch_get_main_queue(), ^{
[spinner startAnimating];
[alert show];
});
您需要在主线程中显示alertView和activityIndicator
dispatch_async(dispatch_get_main_queue(), ^{
[spinner startAnimating];
[alert show];
});
你试过这个吗
[alert setValue:spinner forKey:@"accessoryView"];
在标准警报视图中获取自定义内容。您尝试过吗
[alert setValue:spinner forKey:@"accessoryView"];
在标准警报视图中获取自定义内容。您尝试过吗
[alert setValue:spinner forKey:@"accessoryView"];
在标准警报视图中获取自定义内容。您尝试过吗
[alert setValue:spinner forKey:@"accessoryView"];
在标准警报视图中获取自定义内容。这在iOS 7上是不可能的 使用自定义alertview,请尝试以下操作
这在iOS 7上是不可能的 使用自定义alertview,请尝试以下操作
这在iOS 7上是不可能的 使用自定义alertview,请尝试以下操作
这在iOS 7上是不可能的 使用自定义alertview,请尝试以下操作
UIAlertView
不支持添加子视图,尤其是在iOS 7下。那么,有什么解决方案?特别是为了支持iOS7?不要使用UIAlertView
。查看其他解决方案,例如UIAlertView
不支持添加子视图,特别是在iOS 7下。那么,解决方案可能是什么呢?特别是为了支持iOS7?不要使用UIAlertView
。查看其他解决方案,例如UIAlertView
不支持添加子视图,特别是在iOS 7下。那么,解决方案可能是什么呢?特别是为了支持iOS7?不要使用UIAlertView
。查看其他解决方案,例如UIAlertView
不支持添加子视图,特别是在iOS 7下。那么,解决方案可能是什么呢?特别是为了支持iOS7?不要使用UIAlertView
。研究其他解决方案,例如