Skip to content

stephenlindauer/UIAlertController-Quickie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UIAlertController-Quickie

A small Objective-C category that allows creating a UIAlertView with 1 line of code

Usage

The old way:

UIAlertController *alert = [UIAlertController alertControllerWithTitle:title 
                                                               message:message 
                                                        preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *action = [UIAlertAction actionWithTitle:@"Ok" 
                                                 style:UIAlertActionStyleCancel 
                                               handler:^(UIAlertAction * _Nonnull action) {
    [alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:action];
[viewController presentViewController:alert animated:YES completion:nil];

Using the UIAlertController+Quickie Category:

[UIAlertController showQuickieAlertWithTitle:@"Wow!" message:@"Hey, that was easy!"];

Or show on a specific UIViewController:

[UIAlertController showQuickieAlertWithTitle:@"Wow!" message:@"Hey, that was easy!" fromViewController:otherViewController];

About

A small ObjC category that allows creating a UIAlertView with 1 line of code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published