Add an UIProgressView or UIActivityIndicatorView to your UIAlertView

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

你可能感兴趣的:(Add an UIProgressView or UIActivityIndicatorView to your UIAlertView)