我想在单击表格视图的行时添加活动指示器或 MBProgressHUD,并在下一个视图的表格 laod 时消失。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 1 && indexPath.row == 0) {
/*here add activity indiavtor*/
iMapViewAppDelegate *appDelegate = (iMapViewAppDelegate *)[[UIApplication sharedApplication] delegate];
NSString *requestString = [NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/directions/xml?origin=%@&destination=%@,OK&sensor=false",startField.text,endField.text];
NSURL *url = [[NSURL alloc] initWithString:requestString];
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
//Initialize the delegate.
xml1 *parser = [[xml1 alloc] init];
//Set delegate
[xmlParser setDelegate:parser];
//Start parsing the XML file.
BOOL success = [xmlParser parse];
if(success){
NSLog(@"No Errors");
appDelegate.legAray=[parser.listofPoint copy];
appDelegate.sAray=[parser.ListofSteps1 copy];
arySteps=[[NSArray alloc]init];
arySteps = [parser.ListofSteps1 arrayByAddingObjectsFromArray:parser.listofPoint];
appDelegate.NoofRow=0;
appDelegate.NoofRow=[arySteps count];
NSLog(@"%d",appDelegate.NoofRow);
NSLog(@"%@",arySteps);
sObject=[[Sleg alloc]init];
sObject=[appDelegate.legAray objectAtIndex:0];
}
else
NSLog(@"Error Error Error!!!");
controller= [TableView alloc];
controller.arayStep=[arySteps copy];
[controller initWithNibName:@"TableView" bundle:nil];
[self.navigationController pushViewController:controller animated:YES];
[controller release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
上面的代码用于选择行。在此函数调用时查看添加活动指示器或 MBProgressHUD 并在下一个视图中释放。怎么做?