PRAlertController 0.1.5

PRAlertController 0.1.5

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jun 2015

Maintained by Elethom Hunter.



General

Alert controller with the same APIs as iOS 8 SDK (text field not supported), compatible with iOS 7.

Installation

Usage

It has exactly the same APIs as iOS 8 SDK does except the text field part. Besides, with -show, -dismiss methods you can pop up alerts wherever you want without having to worry about how to get current view controller's pointer.

Example:

PRAlertController *alertController = [PRAlertController alertControllerWithTitle:@"Title"
                                                                         message:@"This is the message."
                                                                  preferredStyle:PRAlertControllerStyleAlert];
PRAlertAction *firstAction = [PRAlertAction actionWithTitle:@"First"
                                                      style:PRAlertActionStyleDefault
                                                    handler:^(PRAlertAction *action) {
                                                        [self doFirstAction];
                                                    }];
PRAlertAction *secondAction = [PRAlertAction actionWithTitle:@"Second"
                                                       style:PRAlertActionStyleDefault
                                                     handler:^(PRAlertAction *action) {
                                                         [self doSecondAction];
                                                     }];
PRAlertAction *destructiveAction = [PRAlertAction actionWithTitle:@"Destructive"
                                                            style:PRAlertActionStyleDestructive
                                                          handler:^(PRAlertAction *action) {
                                                              [self doDestructiveAction];
                                                          }];
PRAlertAction *cancelAction = [PRAlertAction actionWithTitle:@"Cancel"
                                                       style:PRAlertActionStyleCancel
                                                     handler:^(PRAlertAction *action) {
                                                         [self doCancelAction];
                                                     }];
[alertController addAction:firstAction];
[alertController addAction:secondAction];
[alertController addAction:destructiveAction];
[alertController addAction:cancelAction];
[alertController show];

Easy as it seems.

License

This code is distributed under the terms and conditions of the MIT license.

Donate

You can support me by:

:-)

Contact