Latest0.0.2
Homepagehttps://github.com/Subito-it/SBTActionController
LicenseApache License, Version 2.0
Platformsios 5.0, requires ARC
FrameworksUIKit
Authors,

[![CI Status](http://img.shields.io/travis/Mouhcine El Amine/SBTActionController.svg?style=flat)](https://travis-ci.org/Mouhcine El Amine/SBTActionController)
Version
License
Platform

Why use it?

UIActionSheet has been deprecated starting iOS 8 and replaced by UIAlertController which offers a better interface. Unfortunately if you have to support older versions of iOS in your application, you still have to use UIActionSheet. The bad news is that UIActionSheet‘s implementation starting iOS 8 has changed and presents different bugs.

SBTActionController comes with an interface as close as possible to UIAlertController. Under the hood it uses UIAlertController if available, otherwise falls back to using UIActionSheet.

Running the example project

To run the example project, clone the repo, and run pod install from the Example directory first.
Then open the example workspace.

Requirements

Requires Xcode 6 or higher and iOS SDK 8.0 or higher to compile.
Runs on previous versions of iOS SDK but tested only on iOS 7.

Installation

SBTActionController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SBTActionController"

Usage

Create the action controller

SBTActionController *actionController = [SBTActionController actionControllerWithTitle:NSLocalizedString(@"Are you sure?", nil)
                                                                               message:NSlocalizedString(@"Deleting the item is irreversable", nil)];

Create the actions you want to present to the user and add them to action controller

// Create the actions you want to present to the user
SBTAction *deleteAction = [SBTAction actionWithTitle:NSLocalizedString(@"Delete item", nil)
                                               style:UIAlertActionStyleDestructive
                                             handler:^(SBTAction *action) {
                                                // delete item
                                             }];
[actionController addAction:deleteAction];

SBTAction *modifyAction = [SBTAction actionWithTitle:NSLocalizedString(@"Modify item", nil)
                                               style:UIAlertActionStyleDefault
                                             handler:^(SBTAction *action) {
                                                // modify item
                                             }];
[actionController addAction:modifyAction];

SBTAction *cancelAction = [SBTAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
                                               style:UIAlertActionStyleCancel
                                             handler:NULL];
[actionController addAction:cancelAction];

Then present it

[actionController presentActionsFromBarButtonItem:barButtonItem
                                 inViewController:self
                                         animated:YES
                                    completion:NULL];

TO DO

  • Add more tests
  • Set travis CI

Contributions

Contributions are welcome! If you have a bug to report, feel free to help out by opening a new issue or sending a pull request.

Authors

Mouhcine El Amine (@Moxy85)

Luigi Parpinel (@gigisommo)

License

SBTActionController is available under the Apache License, Version 2.0. See the LICENSE file for more info.

Latest podspec

{
    "name": "SBTActionController",
    "version": "0.0.2",
    "summary": "SBTActionController acts as a Fau00e7ade for UIActionSheet and UIAlertController",
    "description": "                       SBTActionController acts as a Fau00e7ade for UIActionSheet and UIAlertController avoiding presentation related issues when using the deprecated UIActionSheet class to support pre iOS 8 versions.n",
    "homepage": "https://github.com/Subito-it/SBTActionController",
    "license": "Apache License, Version 2.0",
    "authors": {
        "Mouhcine El Amine": "[email protected]",
        "Luigi Parpinel": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Subito-it/SBTActionController.git",
        "tag": "0.0.2"
    },
    "platforms": {
        "ios": "5.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes",
    "public_header_files": "Pod/Classes/**/*.h",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This