Latest 1.0.2
License Apache 2.0
Platforms ios 7.0, requires ARC
Frameworks Foundation

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.


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


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


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.


  • iOS 7.0+
  • ARC


@Elenionl, [email protected]


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": "",
    "license": {
        "type": "Apache 2.0",
        "file": ""
    "authors": {
        "Hanping Xu": "[email protected]"
    "social_media_url": "",
    "platforms": {
        "ios": "7.0"
    "source": {
        "git": "",
        "tag": "1.0.2"
    "source_files": "ELAutoSelectorHelper/*",
    "requires_arc": true,
    "frameworks": "Foundation"

Pin It on Pinterest

Share This