I want to display UIProgressView on UIAlertView

user1487562 picture user1487562 · Jul 26, 2012 · Viewed 13.2k times · Source

I want to display UIProgressView on UIAlertView for displaying the processing of uploading of the file. But I have searched too much and also find on that link but sill unable to do that. I don't get idea from this

If anyone know the easiest way to do that then please let me know.

Answer

Pear Johan picture Pear Johan · May 30, 2014

I've had problems doing this, and ended up with this:

av = [[UIAlertView alloc] initWithTitle:@"Running" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
progressView.frame = CGRectMake(0, 0, 200, 15);
progressView.bounds = CGRectMake(0, 0, 200, 15);
progressView.backgroundColor = [UIColor blackColor];

[progressView setUserInteractionEnabled:NO];
[progressView setTrackTintColor:[UIColor blueColor]];
[progressView setProgressTintColor:[UIColor redColor]];
[av setValue:progressView forKey:@"accessoryView"];

[av show];