Last active
September 6, 2015 00:31
-
-
Save iccir/d411b60423a42b16687e to your computer and use it in GitHub Desktop.
MakeAlert()
This file contains 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
extern UIAlertController *MakeAlert(NSString *title, NSString *message, NSString *cancelText, NSString *confirmText, void (^confirmBlock)(BOOL confirmed)); | |
extern UIAlertController *MakeAlert(NSString *title, NSString *message, NSString *cancelText, NSString *confirmText, void (^confirmBlock)(BOOL confirmed)) | |
{ | |
UIAlertController *result = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; | |
if (!confirmText) confirmText = NSLocalizedString(@"OK", nil); | |
if (!cancelText) cancelText = NSLocalizedString(@"Cancel", nil); | |
[result addAction:[UIAlertAction actionWithTitle:cancelText style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { | |
if (confirmBlock) confirmBlock(NO); | |
}]]; | |
[result addAction:[UIAlertAction actionWithTitle:confirmText style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { | |
if (confirmBlock) confirmBlock(YES); | |
}]]; | |
return result; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment