MGEvents 1.2.1

MGEvents 1.2.1

测试已测试
Lang语言 Obj-CObjective C
许可证 BSD-2-Clause
发布上次发布2018 年 9 月

Matt GreenfieldJames Vanas 维护。



MGEvents 1.2.1

  • 作者
  • Matt Greenfield

MGEvents

MGEvents 提供了一个极其轻量级的 API,用于键路径观察、UIControl 事件处理以及观察和触发自定义事件。

CocoaPods 配置

pod 'MGEvents'

示例

#import <MGEvents/MGEvents.h>

键路径观察

[box onChangeOf:@"selected" do:^{
    NSLog(@"the new selected value is: %d", box.selected);
}];

控制事件观察

[button onControlEvent:UIControlEventTouchUpInside do:^{
    NSLog(@"i've been touched up inside. golly.");
}];

或者在 Swift 中

button.onControlEvent(.TouchUpInside) {
    print("you touched me!")
}

自定义事件和触发器

[earth on:@"ChangedShape" do:^{
    NSLog(@"the earth has changed shape");
}];

然后触发事件

[earth trigger:@"ChangedShape"];

更多选项

查看 API 参考 获取更多详细信息。