如何通过解析添加活动指示器?
我想在单击表视图的行时添加活动指示器或 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 并在下一个视图中释放。怎么办呢?
I want to add activity indicator or MBProgressHUD when i click on row of table view and disapear when next view's table 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];
}
}
above code is for selecting row.In when this function call then view add activity indicator or MBProgressHUD and release in next view. How do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在
viewwillAppear
中设置activity.hidden = TRUE;
。set
activity.hidden = TRUE;
inviewwillAppear
.iRam11,
只需实现此代码并询问您是否有任何问题。
NextView.h
声明
NextView.m
iRam11,
Just implement this code and ask if you have any problem.
NextView.h
Declare
NextView.m