Latest 0.7.0
Homepage https://github.com/2020Deception/DeceptionAlertViews
License MIT
Platforms ios 9.0, requires ARC
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Usage

Provide the following line in any classes that will be presenting a type of alertview ->

#import <DeceptionAlertViews/AlertView.h>

The method you will use for showing a UIAlertView/UIAlertController will be :

+ (void)showAlertWithTitle:(NSString *)title  
                message:(NSString *)message  
            cancelBlock:(AlertCancelBlock)alertCancelBlock  
        completionBlocks:(NSArray *)completionBlocks  
        cancelButtonTitle:(NSString *)cancelButtonTitle  
        otherButtonTitles:(NSArray *)otherButtonTitles  
    presentingViewController:(UIViewController *)presentingViewController
                type:(UIAlertControllerStyle)type
            animated:(BOOL)animated  
        completionBlock:(AlertCompletionBlock)alertCompletionBlock;  

To return an UIAlertView/UIAlertController use the following :

+ (void)returnAlertWithTitle:(NSString *)title  
                message:(NSString *)message  
            cancelBlock:(AlertCancelBlock)alertCancelBlock  
        completionBlocks:(NSArray *)completionBlocks  
        cancelButtonTitle:(NSString *)cancelButtonTitle  
        otherButtonTitles:(NSArray *)otherButtonTitles  
    presentingViewController:(UIViewController *)presentingViewController  
                type:(UIAlertControllerStyle)type
            animated:(BOOL)animated  
        completionBlock:(AlertCompletionBlock)alertCompletionBlock;  

Note : the alertCancelBlock is an actual block or ^{} that you will provide as the parameter and completionBlocks is an array of blocks you will pass in with the index corresponding the index of the button in the otherButtonTitles array.
An example implementation :

[AlertView returnAlertWithTitle:@"A Title" message:@"A Message" cancelBlock:^{  
    NSLog(@"cancel block called");  
} completionBlocks:@[^{  
    NSLog(@"block one called"); 
},^{  
    NSLog(@"block two called");  
},^{  
    NSLog(@"block three called");  
}] cancelButtonTitle:@"cancel" otherButtonTitles:@[@"one", @"two", @"three"] presentingViewController:self animated:YES completionBlock:^{  
    NSLog(@"completion block called");  
}];  

Requirements

This is designed to be used with apps that support iOS 4.3 thru iOS 8. Please use the latest commit (preferred) or latest version. It is back supported to iOS 4.3 but the class uses arc and currently does not support non-arc apps.

Installation

DeceptionAlertViews is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod ‘DeceptionAlertViews’, ‘~> 0.6.0’

Author

Anonymous, [email protected]

License

DeceptionAlertViews is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DeceptionAlertViews",
    "version": "0.7.0",
    "summary": "Used to return UIAlert(View|Controller) based on version of iOS. Now makes the latter simpler. Need legacy? Version <= 0.6.2 .",
    "homepage": "https://github.com/2020Deception/DeceptionAlertViews",
    "license": "MIT",
    "authors": {
        "Anonymous": "[email protected]"
    },
    "source": {
        "git": "https://github.com/2020Deception/DeceptionAlertViews.git",
        "tag": "0.7.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/AlertView.{h,m}",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This