UIProgressView in UIAlertView?

While I'm exporting data to a server I'd like to show some sort of progress bar. So far I haven't thought of a decent way to handle that, other than to pop up an alert view with a progress bar. Except I don't see anything in UIAlertView for adding anything other buttons.

I googled and found an o'reilly article, but it appears to be rather out of date. At least, it doesn't work for me. I'm pretty sure I've seen another app do this, but I can't remember which one off the top of my head.

Any suggestions? Is there a better way to do this?

15 Al PowerBook G4, Mac OS X (10.5.4)

Posted on Oct 2, 2008 9:35 PM

Reply
5 replies

Oct 3, 2008 1:07 AM in response to Brandon Fosdick

You just need to add a UIProgressView to your UIAlertView:
This snippet also creates an UIActivityIndicatorView if needed.

- (void) createProgressionAlertWithMessage:(NSString *)message withActivity:(BOOL)activity
{
progressAlert = [[UIAlertView alloc] initWithTitle: message
message: @"Please wait..."
delegate: self
cancelButtonTitle: nil
otherButtonTitles: nil];


// Create the progress bar and add it to the alert
if (activity) {
activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
activityView.frame = CGRectMake(139.0f-18.0f, 80.0f, 37.0f, 37.0f);
[progressAlert addSubview:activityView];
[activityView startAnimating];
} else {
progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(30.0f, 80.0f, 225.0f, 90.0f)];
[progressAlert addSubview:progressView];
[progressView setProgressViewStyle: UIProgressViewStyleBar];
}
[progressAlert show];
[progressAlert release];
}

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

UIProgressView in UIAlertView?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.