ASIHTTPRequest UIProgressView不起作用

时间:2012-02-02 19:38:20

标签: ios progress-bar asihttprequest uiprogressview

我是Xcode的新用户,遇到UIProgressView问题。 我发现了一些代码,但我不太了解它。你能否解释一下为什么UIProgressView在完成后没有关闭?

- (IBAction)Download:(id)sender
{
    NSURL *url = [NSURL URLWithString:@"http://db.tt/5WP2pia"];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDelegate:self];
    [request startAsynchronous];
    progressView = [[UIProgressView alloc]
                          initWithFrame:CGRectMake(30.0f, 80.0f, 225.0f, 90.0f)];
    UIAlertView *progressAlert =
            [[UIAlertView alloc] initWithTitle: @"Download..." 
                                       message: @"Please wait..."
                                      delegate: self
                             cancelButtonTitle: nil 
                             otherButtonTitles: nil];
    [progressAlert addSubview:progressView];
    [progressView setProgressViewStyle: UIProgressViewStyleBar];
    [request setDownloadDestinationPath:@"/var/root/osk.rar"];
    [request setDownloadProgressDelegate:progressView];
    [progressAlert show];
    [progressAlert release];
}

1 个答案:

答案 0 :(得分:0)

  1. 完成ASIHTTPRequest后,您必须手动关闭提醒。 progressView != progressAlert
  2. 请勿使用ASIHTTPRequest