Latest 0.1.1
Homepage https://github.com/pixio/UIAlertController-BetterConstructor
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit
Authors

Version
License
Platform

TL;DR

Turn this:

UIAlertController * ac = [UIAlertController alertControllerWithTitle:@"Not Nice" message:@"So many declarations and lines of code. Why do I have to remember all these types?" preferredStyle:UIAlertControllerStyleAlert];
UIAlertActon * cancelAction = [UIAlertAction actionWithTitle:@"Something Else" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
    NSLog(@"Do something else.");
}];
[ac addAction:defaultAction];
UIAlertActon * cancelAction = [UIAlertAction actionWithTitle:@"Something" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
    NSLog(@"Do something.");
}]
[ac addAction:defaultAction];
[self presentViewController:ac animated:true completion:^{

}];

into this:

UIAlertController * ac = [UIAlertController alertControllerWithTitle:@"Easy" message:@"One method. That's all." style:UIAlertControllerStyleAlert cancelButtonTitle:@"Something Else" cancelButtonBlock:^(UIAlertAction *action) {
    NSLog(@"Do something else.");
} destructiveButtonTitle:nil destructiveButtonBlock:nil otherButtonTitlesAndBlocks:@"Something", ^(UIAlertAction *action) {
    NSLog(@"Do something.");
}, nil];
[self presentViewController:ac animated:true completion:^{

}];

Usage

Just import the header and use the class method to make Alerts and Sheets.

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

UIAlertController-BetterConstructor is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "UIAlertController-BetterConstructor"

Author

Daniel Blakemore, [email protected]

License

UIAlertController-BetterConstructor is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "UIAlertController-BetterConstructor",
    "version": "0.1.1",
    "summary": "A better constructor for UIAlertController.",
    "description": "A category on UIAlertController which provdes a constructor that takes title strings and button blocks for arbitrary alerts and sheets.",
    "homepage": "https://github.com/pixio/UIAlertController-BetterConstructor",
    "license": "MIT",
    "authors": {
        "Daniel Blakemore": "[email protected]"
    },
    "source": {
        "git": "https://github.com/pixio/UIAlertController-BetterConstructor.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "public_header_files": "Pod/Classes/**/*.h",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This