UIControl+BlocksKit.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // UIControl+BlocksKit.h
  3. // BlocksKit
  4. //
  5. #import <UIKit/UIKit.h>
  6. /** Block control event handling for UIControl.
  7. Includes code by the following:
  8. - [Kevin O'Neill](https://github.com/kevinoneill)
  9. - [Zach Waldowski](https://github.com/zwaldowski)
  10. @warning UIControl is only available on a platform with UIKit.
  11. */
  12. @interface UIControl (BlocksKit)
  13. ///-----------------------------------
  14. /// @name Block event handling
  15. ///-----------------------------------
  16. /** Adds a block for a particular event to an internal dispatch table.
  17. @param handler A block representing an action message, with an argument for the sender.
  18. @param controlEvents A bitmask specifying the control events for which the action message is sent.
  19. @see removeEventHandlersForControlEvents:
  20. */
  21. - (void)bk_addEventHandler:(void (^)(id sender))handler forControlEvents:(UIControlEvents)controlEvents;
  22. /** Removes all blocks for a particular event combination.
  23. @param controlEvents A bitmask specifying the control events for which the block will be removed.
  24. @see addEventHandler:forControlEvents:
  25. */
  26. - (void)bk_removeEventHandlersForControlEvents:(UIControlEvents)controlEvents;
  27. /** Checks to see if the control has any blocks for a particular event combination.
  28. @param controlEvents A bitmask specifying the control events for which to check for blocks.
  29. @see addEventHandler:forControlEvents:
  30. @return Returns YES if there are blocks for these control events, NO otherwise.
  31. */
  32. - (BOOL)bk_hasEventHandlersForControlEvents:(UIControlEvents)controlEvents;
  33. @end