Latest 0.0.4
Homepage https://github.com/mysterioustrousers/MTControl
License BSD
Platforms ios , requires ARC
Authors

Attach block handlers to UIControl objects jQuery style!

Installation

In your Podfile, add this line:

pod "MTControl"

pod? => https://github.com/CocoaPods/CocoaPods/

NOTE: You may need to add -all_load to "Other Linker Flags" in your targets build settings if the pods library only contains categories.

Example Usage

A simple touch down event:

UIButton *button = [UIButton buttonWithType:UIButtonTypeContactAdd];

;
    [_model fetchFromServer:@"http://mysterioustrousers.com" success:^(BOOL success){
        [_spinner stop];
    }];
}];

See? Just like jQuery! Works with any subclass of UIControl.

Let’s try another:

UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 300, 40)];

[textField editingDidBegin:^(UIEvent *event) {
    textField.text = @"";
}];

And to remove the block (unbind):

;

Control Event Binding Methods:

touchDown
touchDownRepeat
touchDragInside
touchDragOutside
touchDragEnter
touchDragExit
touchUpInside
touchUpOutside
touchCancel
valueChanged
editingDidBegin
editingChanged
editingDidEnd
editingDidEndOnExit
allTouchEvents
allEditingEvents

Latest podspec

{
    "name": "MTControl",
    "version": "0.0.4",
    "summary": "Attach block handlers to UIControl objects jQuery style.",
    "homepage": "https://github.com/mysterioustrousers/MTControl",
    "license": "BSD",
    "authors": {
        "Adam Kirk": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mysterioustrousers/MTControl.git",
        "tag": "0.0.4"
    },
    "platforms": {
        "ios": null
    },
    "source_files": "MTControl/UIControl+MTControl.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This