static UIAlertView *_alertView = nil;
- + (void)showAlert:(NSString *)aTitle message:(NSString *)aMessage delegate:(id<UIAlertViewDelegate>)aDelegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...{
- if (_alertView.isVisible) {
- return;
- }
- if (_alertView != nil) {
- [_alertView release],_alertView = nil;
- }
- _alertView = [[UIAlertView alloc] initWithTitle:aTitle message:aMessage delegate:aDelegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil];
- if (otherButtonTitles != nil) {
- va_list args;
- va_start(args, otherButtonTitles);
- NSString* arg = nil;
- [_alertView addButtonWithTitle:otherButtonTitles];
- while ( ( arg = va_arg( args, NSString*) ) != nil ) {
- [_alertView addButtonWithTitle:arg];
- }
- va_end(args);
- }
- [_alertView show];
- }
转载于:https://blog.51cto.com/roybaby/1066990