Latest 1.0.2
Homepage https://github.com/Elenionl/ELAutoSelector
License Apache 2.0
Platforms ios 7.0, requires ARC
Frameworks Foundation
Authors

Change target action into blocks

If you feel - (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents; is too complex to use, try ELAutoSelector.

Install

pod 'ELAutoSelector', '~> 1.0.2'
pod install

Use

    #import "ELAutoSelectorHelper.h"
    // In implementation
    [myButton addTarget:ELTarget action:ELAction(^(id  _Nonnull _self, id  _Nonnull sender) {
        ...
        // What you want to do
    }, self) forControlEvents:UIControlEventTouchUpInside];

Attention

ELAction(,) Function

ELAction(action, dependency)
Action is the block to be exectuted when event happened.
Dependency is the object to determine action‘s life.
If dependency is nil, action will never be released, never will the object captured strongly by action.
If dependency is captured strongly by action, this will leads to a memory leak, resulting in action and dependency is never released.

Requirements

  • iOS 7.0+
  • ARC

Author

@Elenionl, [email protected]

License

English: ELAutoSelector is available under the Apache 2.0 license, see the LICENSE file for more information.

Latest podspec

{
    "name": "ELAutoSelector",
    "version": "1.0.2",
    "summary": "A light-weight tool helps developers use block for 'target action' kind methods",
    "description": "If you feel `- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;` is too complex to use, try ELAutoSelector.nIt is very easy to use:nn#import "ELAutoSelectorHelper.h"n...n// In implementationn  [myButton addTarget:ELTarget action:ELAction(^(id  _Nonnull _self, id  _Nonnull sender) {n      ...n      // What you want to don  }, self) forControlEvents:UIControlEventTouchUpInside];n...",
    "homepage": "https://github.com/Elenionl/ELAutoSelector",
    "license": {
        "type": "Apache 2.0",
        "file": "LICENSE.md"
    },
    "authors": {
        "Hanping Xu": "[email protected]"
    },
    "social_media_url": "https://github.com/Elenionl",
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/Elenionl/ELAutoSelector.git",
        "tag": "1.0.2"
    },
    "source_files": "ELAutoSelectorHelper/*",
    "requires_arc": true,
    "frameworks": "Foundation"
}

Pin It on Pinterest

Share This