Latest 0.0.1
Homepage https://github.com/npalamar/NPAAViewHelper
License MIT
Platforms ios 7.0, requires ARC
Authors

NPAAViewHelper

With the release of iOS
8, we have the new UIAlertController for showing alerts and actionsheets in code so we usually add logic
for cheking current iOS version for showing UIAlertView / UIActionSheet or UIAlertController. This is the simple library that helps with that.

Overview

AlertView methods

For showing simple AlertView with OK button, use this code:

[NPAlertViewHelper showOkAlertWithTitle:@"Title" withMessage:@"Message" presenter:self];

If you want use more complicated AlertView make something like this:

    NPAAButtonHandler rateNowHandler = ^{
        NSLog("Rate Now");
    };

    NPAAButtonHandler neverAskHandler = ^{
        NSLog("Never Ask");
    };

    NPAAButtonHandler remindLaterHandler = ^{
        NSLog("Remind me Later");
    };

    NPAlertViewHelper *alert = [[NPAlertViewHelper alloc] initWithTitle:@"Title" message:@"Message"];
    [alert addDefaultButtonWithTitle:@"Rate Now"        handler:rateNowHandler];
    [alert addDefaultButtonWithTitle:@"Never Ask"       handler:neverAskHandler];
    [alert addDefaultButtonWithTitle:@"Remind me Later" handler:remindLaterHandler];
    [alert showInViewController:self];

ActionsSheet methods

For showing ActionSheet use somethig like this:

    NPAAButtonHandler emailButtonHandler = ^{
        NSLog("Rate Now");
    };

    NPAAButtonHandler facebookButtonHandler = ^{
        NSLog("Never Ask");
    };

    NPActionSheetViewHelper *actionSheet = [NPActionSheetViewHelper new];
    [actionSheet addDefaultButtonWithTitle:@"E-Mail"   handler:emailButtonHandler];
    [actionSheet addDefaultButtonWithTitle:@"Facebook" handler:facebookButtonHandler];
    [actionSheet addCancelButtonWithTitle:@"Cancel"    handler:nil];
    [actionSheet showInViewController:self];

Requirements

  • iOS 7 or later

CocoaPods

You can install this code via CocoaPods

pod 'NPAAViewHelper'

License

  • NPAAViewHelper is available under the MIT License. See the LICENSE.

Contact

If you have some advices or ideas, please send me an email:
[email protected]

Latest podspec

{
    "name": "NPAAViewHelper",
    "version": "0.0.1",
    "summary": "This is the library for easy usign Alert and ActionSheets in iOS 7 / 8.",
    "description": "                   A longer description of NPAAViewHelper in Markdown format.nn                   * Think: Why did you write this? What is the focus? What does it do?n                   * CocoaPods will be using this to generate tags, and improve search results.n                   * Try to keep it short, snappy and to the point.n                   * Finally, don't worry about the indent, CocoaPods strips it!n",
    "homepage": "https://github.com/npalamar/NPAAViewHelper",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Nikolay Palamar": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/npalamar/NPAAViewHelper.git",
        "tag": "0.0.1"
    },
    "source_files": "Classes/**/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This