Latest 0.1.0
Homepage https://github.com/HyanCat/HyUIActionEvent
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation, UIKit
Authors

An elegant way to handle UI action events based on UIResponder.

Swift version

Installation

By using Cocoapods, Add library in your Podfile.

pod 'HyUIActionEvent'

Usage

  1. Event.

    The event class named HyUIActionEvent.
    You can create an event object manually and then dispatch it.

    By another way, it provide a property eventName for UIView and UIControl. After assigned the eventName property, an event object also been associated to this target.

  2. Dispatch event.

    HyUIActionEvent *event = [HyUIActionEvent eventWithName:@"eventNameA" object:objOrNil userInfo:@{@"key1": @"value1"}];
    [someObject dispatchHyUIActionEvent:event];

    If, we just want to add a tap on a view, or a touch event on a button.

    someView.eventName = @"eventNameA";
    soneView.eventUserInfo = @{@"key1": @"value1"}; // Optional.
  3. Handle event.

    Actually, We can handle events in any class inherited from UIResponder, but by sugguestion, you should always handle events in a view controller.

    // handle an event by construct a method.
    // handle{$eventName}WithActionEvent:
    // return a HyUIActionEventResult object, it provide a boolean value that tell the respond chain whether should continue dispatching event or not.
    - (HyUIActionEventResult *)handleEventNameAWithActionEvent:(HyUIActionEvent *)actionEvent {
        // some code here...
        return [HyUIActionEventResult resultWithContinueDispatching:NO];    // So this event will not be past.
    }

License

MIT License

Latest podspec

{
    "name": "HyUIActionEvent",
    "version": "0.1.0",
    "summary": "An elegant way to handle UI action events based on UIResponder.",
    "license": "MIT",
    "description": "An elegant way to handle UI action events based on UIResponder, simply and powerful.",
    "homepage": "https://github.com/HyanCat/HyUIActionEvent",
    "authors": {
        "HyanCat": "[email protected]"
    },
    "source": {
        "git": "https://github.com/HyanCat/HyUIActionEvent.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "default_subspecs": "Core",
    "subspecs": [
        {
            "name": "Core",
            "source_files": "HyUIActionEvent/Classes/Core/*.{h,m}",
            "public_header_files": "HyUIActionEvent/Classes/Core/*.h"
        },
        {
            "name": "Transition",
            "dependencies": {
                "HyUIActionEvent/Core": []
            },
            "source_files": "HyUIActionEvent/Classes/Transition/*.{h,m}",
            "public_header_files": "HyUIActionEvent/Classes/Transition/*.h"
        }
    ]
}

Pin It on Pinterest

Share This