Last active
December 28, 2015 09:59
-
-
Save sag333ar/7482696 to your computer and use it in GitHub Desktop.
Show Alertview with one-line of code & also detect alertview with tag.
Examples are as follows
ALERT_WITH_TAG(100, @"Message", @"send this request", nil, self, @"Yes", @"No",nil);
ALERT_WITH_TAG(100, @"Message", @"Data deleted", @"Okay", self, nil);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ALERT_WITH_TAG(NSUInteger tag,NSString *title, NSString *message,NSString *canceBtnTitle,id delegate,NSString *otherButtonTitles, ... ) | |
{ | |
UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:title | |
message:message | |
delegate:delegate | |
cancelButtonTitle:canceBtnTitle | |
otherButtonTitles:nil | |
]; | |
va_list args; | |
va_start(args, otherButtonTitles); | |
NSString *obj; | |
for (obj = otherButtonTitles; obj != nil; obj = va_arg(args, NSString*)) | |
[alertView addButtonWithTitle:obj]; | |
va_end(args); | |
alertView.tag = tag; | |
[alertView show]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment