Latest 0.5.0
Homepage https://github.com/jlmendezbonini/UIActionSheet-AutomaticActions
License MIT
Platforms ios 7.0, requires ARC
Authors

Experimental UIActionSheet category that always invokes the correct action. See my personal blog for a detailed description of the implementation.

Installation

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

pod "UIActionSheet+AutomaticActions"

Usage

Create and array of actions. Each action is represented as a NSDictionary object in the form: @{ NSString : selector as NSString }.

NSArray *actionSheetItems = @[ @{ @"Action 1" : NSStringFromSelector(@selector(sheet1Action1)) },
                               @{ @"Action 2" : NSStringFromSelector(@selector(sheet1Action2)) },
                               @{ @"Action 3" : NSStringFromSelector(@selector(sheet1Action3)) },
                               @{ @"Cancel" : [NSNull null] } ];

Instantiate an UIActionSheet using -initWithItems:delegate and show as usual.

UIActionSheet *as = [[UIActionSheet alloc] jlm_initWithItems:items delegate:self];
[as showInView:self.view];

UIActionSheet deprecated in iOS 8+

Good discussion at NSHipster about the use of the new UIAlertController instead of UIActionSheet

Author

Jorge Luis Mendez, [email protected]

Latest podspec

{
    "name": "UIActionSheet+AutomaticActions",
    "version": "0.5.0",
    "summary": "Experimental UIActionSheet category that always invokes the correct selector.",
    "homepage": "https://github.com/jlmendezbonini/UIActionSheet-AutomaticActions",
    "license": "MIT",
    "authors": {
        "Jorge Luis Mendez": "[email protected]"
    },
    "source": {
        "git": "https://github.com/jlmendezbonini/UIActionSheet-AutomaticActions.git",
        "tag": "0.5.0"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "*.{h,m}"
}

Pin It on Pinterest

Share This