UIProgressView in UIAlertView

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];
}

Tagged:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: