iphone UIAlertview UIIndicatorview

iphone UIAlertview UIIndicatorview,iphone,Iphone,我是Iphone开发的新手。我有一个表单,在这个表单中,为了显示数据,我调用了一个Web服务。调用该服务时,它将从其他文件解析,页面将导航到“发送页面”,其中这些数据显示在UITableview中 我还使用uiAtertview和UIIndicatorview来显示流程正在进行。但问题是,当我点击按钮时,我调用UIAtertView+UIIndicator,但它并没有显示,数据也并没有显示 我的代码是 UIAlertView *alert = [[UIAlertView alloc] initW

我是Iphone开发的新手。我有一个表单,在这个表单中,为了显示数据,我调用了一个Web服务。调用该服务时,它将从其他文件解析,页面将导航到“发送页面”,其中这些数据显示在UITableview中

我还使用uiAtertview和UIIndicatorview来显示流程正在进行。但问题是,当我点击按钮时,我调用UIAtertView+UIIndicator,但它并没有显示,数据也并没有显示

我的代码是

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Configuring Preferences\nPlease Wait.." message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil,nil];
[alert show];


UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

// Adjust the indicator so it is up a few pixels from the bottom of the alert
indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
[indicator startAnimating];
[alert addSubview:indicator];
[indicator release];

self.ResultPage = [[ResultPage alloc] init];
self.title=@"    Search    ";

// Here My Webservice Is Call From Another ViewController Class And That Class Display Data //InTo UITableVIew

[self.ResultPage GetSearchResult:StrBookId : txtFPrice.text :txtTprice.text];
[alert dismissWithClickedButtonIndex:0 animated:YES];
[self.navigationController pushViewController: _ResultPage animated:YES];
请建议我


Thanx

您可以在警报视图中添加活动指示器,并在调用web服务时显示警报视图。我在调用web服务时也会这样做。它锁定视图,这样用户就不能点击任何东西,而且看起来也很好,并指示用户正在进行某些操作

在.h文件中

UIAlertView *progressAlert;
在.m文件中

-(void)showAlertMethod

{
    NSAutoreleasePool *pool1=[[NSAutoreleasePool alloc]init];           
progressAlert = [[UIAlertView alloc] initWithTitle:@"Uploading please wait...\n" message:@"" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
    CGRect alertFrame = progressAlert.frame;
    UIActivityIndicatorView* activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    activityIndicator.frame = CGRectMake(135,alertFrame.size.height+55, alertFrame.size.width,30);
    activityIndicator.hidden = NO;
    activityIndicator.contentMode = UIViewContentModeCenter;
    [activityIndicator startAnimating]; 
    [progressAlert addSubview:activityIndicator];
    [activityIndicator release];
    [progressAlert show];
    [pool1 release];

}
-(void)dismissAlertMethod
{
    NSAutoreleasePool *pool2=[[NSAutoreleasePool alloc]init];
    [progressAlert dismissWithClickedButtonIndex:0 animated:YES];
    [pool2 release];
}
根据您的需求调用该方法。 我以这种方式调用这些方法:-

[NSThread detachNewThreadSelector:@selector(showAlertMethod) toTarget:self withObject:nil];

[NSThread detachNewThreadSelector:@selector(dismissAlertMethod) toTarget:self withObject:nil];

您可以在警报视图中添加活动指示器,并在调用web服务时显示该警报视图。我在调用web服务时也会这样做。它锁定视图,这样用户就不能点击任何东西,而且看起来也很好,并指示用户正在进行某些操作

在.h文件中

UIAlertView *progressAlert;
在.m文件中

-(void)showAlertMethod

{
    NSAutoreleasePool *pool1=[[NSAutoreleasePool alloc]init];           
progressAlert = [[UIAlertView alloc] initWithTitle:@"Uploading please wait...\n" message:@"" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
    CGRect alertFrame = progressAlert.frame;
    UIActivityIndicatorView* activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    activityIndicator.frame = CGRectMake(135,alertFrame.size.height+55, alertFrame.size.width,30);
    activityIndicator.hidden = NO;
    activityIndicator.contentMode = UIViewContentModeCenter;
    [activityIndicator startAnimating]; 
    [progressAlert addSubview:activityIndicator];
    [activityIndicator release];
    [progressAlert show];
    [pool1 release];

}
-(void)dismissAlertMethod
{
    NSAutoreleasePool *pool2=[[NSAutoreleasePool alloc]init];
    [progressAlert dismissWithClickedButtonIndex:0 animated:YES];
    [pool2 release];
}
根据您的需求调用该方法。 我以这种方式调用这些方法:-

[NSThread detachNewThreadSelector:@selector(showAlertMethod) toTarget:self withObject:nil];

[NSThread detachNewThreadSelector:@selector(dismissAlertMethod) toTarget:self withObject:nil];

锁定屏幕的好方法,从未尝试过,但似乎很酷…我仍然怀疑锁定屏幕,不让任何事情发生是多么好…再次,我在Neeta发布的代码中看到,alertView首先显示,然后activityIndicator被添加到其中,我觉得这可能是问题所在,Neeta方面的一点详细代码可能有助于解决问题。锁定屏幕的好方法,从未尝试过,但似乎很酷…我仍然怀疑锁定屏幕和不让任何事情发生有多好…再一次,我在Neeta发布的代码中看到,首先显示alertView,然后添加activityIndicator,我觉得这可能是问题所在,Neeta方面的一些详细代码可能有助于解决问题。您确定为指示器视图中心设置的高度正确吗?您确定为指示器视图中心设置的高度正确吗??