Skip to content

Convenience methods for UIAlertController. It can add custom style (defalut and destructive) and actions sort by index of NSArray which contain items of custom style's actions.

License

Notifications You must be signed in to change notification settings

cievon/UIAlertController-Blocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UIAlertController+CNBlocks

Convenience methods for UIAlertController. It can add custom style (defalut and destructive) and actions sort by index of NSArray which contain items of custom style's actions.

Requirements

  • Greater iOS 8.0.

Usage

  • Add UIAlertController+CNBlocks.h/m into your project.

Alert

Showing Alert Viiew in current toppest ViewController. Items contain title、message、cancel action、confirm action.

[UIAlertController cn_showAlertViewWithTitle:_title message:_message cancelTitle:_cancelTitle confirmTitle:_confirmTitle confirm:^{
        NSLog(@"I'm a adult!");
    }];

Showing alert in current toppest viewController. Items contain title、message、add multiple defalut style action、cancel action.

[UIAlertController cn_showAlertViewWithTitle:_title message:_message defalutActionTitles:_defalutActionTitles cancelTitle:_cancelTitle complete:^(NSUInteger index) {
        NSLog(@"index:%ld-- I'm %@", index, self->_defalutActionTitles[index]);
    }];

Showing alert in specified viewController. Items contain title、message、add multiple custom style (see CNAlertActionStyle) action、cancel action.

[UIAlertController cn_alertViewShowInViewController:self title:_title message:_message customActionTitles:_customStyleActionTitles cancelTitle:_cancelTitle complete:^(NSUInteger index) {
        NSLog(@"index:%ld-- %@", index, self->_customStyleActionTitles[index].allValues.firstObject);
    }];

ActionSheet

Showing action sheet in specified viewController. Items contain title、message、cancel action、confirm action.

[UIAlertController cn_actionSheetShowInViewController:self title:_title message:_message cancelTitle:_cancelTitle confirmTitle:_confirmTitle confirm:^{
        NSLog(@"I'm a adult!");
    }];

Showing action sheet in current toppest viewController. Items contain title、message、add multiple defalut style action、cancel action.

[UIAlertController cn_showActionSheetWithTitle:_title message:_message defalutActionTitles:_defalutActionTitles cancelTitle:_cancelTitle complete:^(NSUInteger index) {
        NSLog(@"index:%ld-- I'm %@", index, self->_defalutActionTitles[index]);
    }];

Showing action sheet in current toppest viewController. Items contain title、message、add multiple custom style (see CNAlertActionStyle) action、cancel action.

[UIAlertController cn_showActionSheetWithTitle:_title message:_message customActionTitles:_customStyleActionTitles cancelTitle:_cancelTitle complete:^(NSUInteger index) {
        NSLog(@"index:%ld-- %@", index, self->_customStyleActionTitles[index].allValues.firstObject);
    }];

License

  • UIAlertController+CNBlocks is available under the MIT license. See the LICENSE

About

Convenience methods for UIAlertController. It can add custom style (defalut and destructive) and actions sort by index of NSArray which contain items of custom style's actions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published