PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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