我有一个显示模态视图的应用程序。在最后的模态视图中,我有一个表单。一旦点击完成按钮,就会调用一个Web服务,它传递从用户输入的值。收到回复后,模态视图被解除。我希望显示警报或操作表,要求用户等待,因为Web服务调用需要很长时间。问题在于警报或操作表只有在视图被解除后才会显示。这是为什么发生?以下是完成功能的代码:在模态视图中显示警报
-(void)reg:(id)sender {
if([password length] == 0) {
//show alert
}
//other validation
//This is were I write the alert
UIActivityIndicator *activity = [[UIActivityIndicator alloc] initWithActivityIndicatorStyle:
UIActivityIndicatorStyleWhite];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Processing" delegate:self otherButtonTitles:nil];
[alert addSubview:activity];
[activity startAnimating];
[alert show];
WebServiceController *web = [[WebServiceController alloc]init];
//webservice called
//getting the response
//dismissing alert here
[self dismissModalViewControllerAnimated:YES];
}
您可以发布警报代码吗? – visakh7 2011-03-08 11:37:12