0

I´m new in Xcode and have a problem with UIProgressView. I found some code but I don't understand it well. Could you please explain me why UIProgressView is not closing after finish?

- (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];
}
iHunter
  • 6,205
  • 3
  • 38
  • 56

1 Answers1

0
  1. You have to manually close the alert, after ASIHTTPRequest is done. progressView != progressAlert
  2. Don't use ASIHTTPRequest