Latest 1.0
Homepage https://github.com/DingHub/ChainableAlert-OC
License MIT
Platforms ios 6.0, requires ARC
Authors

Chainable usage of Alert.

We have a helper named ZRDChainableAlert, and a category of UIViewController to add chainable usage of UIalertController.
Usage:

in view controller:


#import "UIViewController+ZRDChainableAlert.h"
    [self actionSheet:@"Title" message:@"message"]
    .normalButton(@"normal1")
    .handler(^(ZRDChainableAlert *alert) {
        NSLog(@"normal1");
    })
    .normalButton(@"normal2")
    .normalButton(@"normal3")
    .destructiveButton(@"destructive1")
    .handler (^(ZRDChainableAlert *alert) {
        NSLog(@"destructive1");
    })
    .destructiveButton(@"destructive2")
    .cancelButton(@"cancel")
    .show
    .animated(YES)
    .completion(nil);

or an alert with textFeilds:

    [self alert:@"Title" message:@"message"]
    .configTextField(^(UITextField *textField) {
        textField.placeholder = @"UserName";
    })
    .configTextField(^(UITextField *textField) {
        textField.placeholder = @"Password";
        textField.secureTextEntry = YES;
    })
    .normalButton(@"Login")
    .handler(^(ZRDChainableAlert *alert) {
        NSArray *textFields = alert.textFields;
        NSLog(@"nUsername:%@nPassword:%@", [textFields[0] text], [textFields[1] text]);
    })
    .cancelButton(@"cancel")
    .show
    .animated(YES)
    .completion(nil);

Pod supported:

target 'YourTarget' do
pod 'ChainableAlert-OC'
end

You can find a Swift version here: ChainableAlert

Latest podspec

{
    "name": "ChainableAlert-OC",
    "version": "1.0",
    "license": "MIT",
    "summary": "Chainable use of Alert.",
    "homepage": "https://github.com/DingHub/ChainableAlert-OC",
    "authors": {
        "DingHub": "[email protected]"
    },
    "source": {
        "git": "https://github.com/DingHub/ChainableAlert-OC.git",
        "tag": "1.0"
    },
    "source_files": "Source/*.{h,m}",
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This