/BlocksKit/UIBarButtonItem+BlocksKit.h

http://github.com/zwaldowski/BlocksKit · C Header · 51 lines · 6 code · 6 blank · 39 comment · 0 complexity · 2c61d95b65bc49c891175e46d64d766e MD5 · raw file

  1. //
  2. // UIBarButtonItem+BlocksKit.h
  3. // %PROJECT
  4. //
  5. #import "BKGlobals.h"
  6. /** Block event initialization for UIBarButtonItem.
  7. This set of extensions has near-drop-in replacements
  8. for the standard set of UIBarButton item initializations,
  9. using a block handler instead of a target/selector.
  10. Includes code by the following:
  11. - Kevin O'Neill. <https://github.com/kevinoneill>. 2011. BSD.
  12. - Zach Waldowski. <https://github.com/zwaldowski>. 2011. MIT.
  13. @warning UIBarButtonItem is only available on iOS or in a Mac app using Chameleon.
  14. */
  15. @interface UIBarButtonItem (BlocksKit)
  16. /** Creates and returns a configured item containing the specified system item.
  17. @return Newly initialized item with the specified properties.
  18. @param systemItem The system item to use as the item representation. One of the constants defined in UIBarButtonSystemItem.
  19. @param action The block that gets fired on the button press.
  20. */
  21. - (id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem handler:(BKSenderBlock)action;
  22. /** Creates and returns a configured item using the specified image and style.
  23. @return Newly initialized item with the specified properties.
  24. @param image The itemâ&#x20AC;&#x2122;s image. If nil an image is not displayed.
  25. If this image is too large to fit on the bar, it is scaled to fit
  26. The size of a toolbar and navigation bar image is 20 x 20 points.
  27. @param style The style of the item. One of the constants defined in UIBarButtonItemStyle.
  28. @param action The block that gets fired on the button press.
  29. */
  30. - (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style handler:(BKSenderBlock)action;
  31. /** Creates and returns a configured item using the specified text and style.
  32. @return Newly initialized item with the specified properties.
  33. @param title The text displayed on the button item.
  34. @param style The style of the item. One of the constants defined in UIBarButtonItemStyle.
  35. @param action The block that gets fired on the button press.
  36. */
  37. - (id)initWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style handler:(BKSenderBlock)action;
  38. @end