1. static UIAlertView *_alertView = nil;

  2. + (void)showAlert:(NSString *)aTitle message:(NSString *)aMessage delegate:(id)aDelegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...{ 
  3.      
  4.     if (_alertView.isVisible) { 
  5.         return
  6.     } 
  7.     if (_alertView != nil) { 
  8.         [_alertView release],_alertView = nil; 
  9.     } 
  10.     _alertView = [[UIAlertView alloc] initWithTitle:aTitle message:aMessage delegate:aDelegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil]; 
  11.     if (otherButtonTitles != nil) { 
  12.         va_list args; 
  13.         va_start(args, otherButtonTitles); 
  14.         NSString* arg = nil; 
  15.         [_alertView addButtonWithTitle:otherButtonTitles]; 
  16.         while ( ( arg = va_arg( args, NSString*) ) != nil ) { 
  17.             [_alertView addButtonWithTitle:arg]; 
  18.         } 
  19.         va_end(args); 
  20.     } 
  21.     [_alertView show];