我取出由Web服務的數據,並在UIActivityIndicatorView的數據讀取,我在屏幕上顯示一個UIAcitivityIndicatorView
。該指標是UIAlertView
駁回的背景觸摸
UIAlertView *waitAlert = [[UIAlertView alloc] initWithTitle:@"Please Wait...." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
[waitAlert show];
indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
// Adjust the indicator so it is up a few pixels from the bottom of the alert
indicator.center = CGPointMake(waitAlert.bounds.size.width/2, waitAlert.bounds.size.height - 50);
[waitAlert addSubview:indicator];
NSURL *url = [NSURL URLWithString:URLString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[NSThread detachNewThreadSelector:@selector(startAnimation) toTarget:self withObject:self.view];
[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
// Data to populate the tableview
[[NSOperationQueue mainQueue] addOperationWithBlock:^ {
[self.tableView1 reloadData];
//Stop the UIActivitiyIndicatorView
[self stopLoading];
}];
}];
我能夠解僱,成功地在數據加載成功,但我想駁回UIActivityIndicatorView
,如果有人從Web服務中的數據加載過程中屏幕的其他部分觸及。任何幫助將不勝感激。
如果我在UIAlertView中使用活動指示器,這樣工作嗎? – Atul
沒有必要一起顯示UIAlertView和UIActivityIndicator。 –
但在情況下,如果你只想檢查誰是UIResponder鏈 –