/BlocksKit/UIControl+BlocksKit.h

http://github.com/zwaldowski/BlocksKit · C++ Header · 44 lines · 6 code · 7 blank · 31 comment · 0 complexity · f896dc3ac1b08a841d54ce98be51319f MD5 · raw file

  1. //
  2. // UIControl+BlocksKit.h
  3. // %PROJECT
  4. //
  5. #import "BKGlobals.h"
  6. /** Block control event handling for UIControl.
  7. Includes code by the following:
  8. - Kevin O'Neill. <https://github.com/kevinoneill>. 2011. BSD.
  9. - Zach Waldowski. <https://github.com/zwaldowski>. 2011. MIT.
  10. @warning UIControl is only available on iOS or in a Mac app using Chameleon.
  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)addEventHandler:(BKSenderBlock)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)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)hasEventHandlersForControlEvents:(UIControlEvents)controlEvents;
  33. @end