-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIAlertController+Quickie.m
29 lines (22 loc) · 1.08 KB
/
UIAlertController+Quickie.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//
// UIAlertController+Quickie.m
//
// Created by Stephen Lindauer on 7/28/16.
// 1 liner to show a simple alert using a UIAlertController
//
#import "UIAlertController+Quickie.h"
@implementation UIAlertController (Quickie)
+ (void)showQuickieAlertWithTitle:(NSString *)title message:(NSString *)message fromViewController:(UIViewController *)viewController
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}]];
[viewController presentViewController:alert animated:YES completion:nil];
}
+ (void)showQuickieAlertWithTitle:(NSString *)title message:(NSString *)message
{
UIViewController *viewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
[self showQuickieAlertWithTitle:title message:message fromViewController:viewController];
}
@end