Latest 0.0.2
License MIT
Platforms ios , requires ARC

JSAlertView comes with few handy methods for showing simple alerts.

For example, if you want to display a simple alert with "Ok" button, you will have to write couple of lines of code as below

using UIAlertController:

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Title" message:@"This is a simple alert." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* okButton = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
    [alert dismissViewControllerAnimated:YES completion:nil];
[alert addAction:okButton];

[self presentViewController:alert animated:animated completion:nil];

using UIAlertView:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"This is a simple alert." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];

but using JSAlertView its short and simple,

[JSAlertView alert:@"This is a simple alert."];


Alert(@"This is a simple alert.");

super easy, right?

Another handy method is for asking user a question, like a confirmation dialog,

[JSAlertView confirm:@"Did you like this alert?" withCompletionHandler:^(BOOL accepted) {
    NSLog(@"%@", (accepted ? @"YES" : @"NO"));

Lastly, you can use the following method for full customization:

[JSAlertView alert:@"Alert with multiple buttons." withTitle:@"Alert Title" buttons:@[@"Button 1",@"Button 2",@"Button 3",@"Button 4",@"Button 5"] withCompletionHandler:^(NSInteger buttonIndex, NSString *buttonTitle) {
    NSLog(@"Pressed %@ at index %ld", buttonTitle, (long)buttonIndex);

JSAlertView can be used for any iOS version without any worry for support for UIAlertView in any iOS version.

Use it

Add pod ‘JSAlertView’ to your Podfile or copy ‘JSAlertView.h’ and ‘JSAlertView.m’ in your project.

Latest podspec

    "name": "JSAlertView",
    "version": "0.0.2",
    "license": "MIT",
    "summary": "JSAlertView is a wrapper class for UIAlertView and UIAlertViewController.",
    "description": "JSAlertView is a subclass of UIAlertView/UIAlertViewController that would provide common method for UIAlertView and UIAlertViewController and chooses whatever is compatible as per running iOS version.",
    "authors": {
        "Jitendra Singh": ""
    "source": {
        "git": "",
        "tag": "0.0.2"
    "homepage": "",
    "platforms": {
        "ios": null
    "source_files": "Source",
    "requires_arc": true

Pin It on Pinterest

Share This