Created
August 20, 2015 13:01
-
-
Save macecchi/ada255f4950e3e002b16 to your computer and use it in GitHub Desktop.
Category with simple static method to present an alert with an "OK" button using iOS lib PSTAlertController
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
#import <PSTAlertController.h> | |
@interface PSTAlertController (okAlert) | |
+ (PSTAlertController *)presentOkAlertWithTitle:(NSString *)title andMessage:(NSString *)message; | |
+ (PSTAlertController *)presentOkAlertWithTitle:(NSString *)title andMessage:(NSString *)message andHandler:(void (^)(PSTAlertAction *action))handler; | |
@end |
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
#import "PSTAlertController+okAlert.h" | |
@implementation PSTAlertController (okAlert) | |
+ (PSTAlertController *)presentOkAlertWithTitle:(NSString *)title andMessage:(NSString *)message andHandler:(void (^)(PSTAlertAction *))handler { | |
PSTAlertController *alertController = [PSTAlertController alertWithTitle:title message:message]; | |
[alertController addAction:[PSTAlertAction actionWithTitle:@"OK" handler:handler]]; | |
[alertController showWithSender:nil controller:nil animated:YES completion:nil]; | |
return alertController; | |
} | |
+ (PSTAlertController *)presentOkAlertWithTitle:(NSString *)title andMessage:(NSString *)message { | |
return [PSTAlertController presentOkAlertWithTitle:title andMessage:message andHandler:nil]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment