Permalink
Browse files

Added itemWithLabel:action:

Buttons can be initialised at the same time as they are used.
  • Loading branch information...
1 parent 6753178 commit e2c23df0708c7afb6a824d26d433a447c89dda30 @p-l p-l committed Aug 14, 2012
Showing with 8 additions and 0 deletions.
  1. +1 −0 RIButtonItem.h
  2. +7 −0 RIButtonItem.m
View
1 RIButtonItem.h
@@ -17,5 +17,6 @@
@property (copy, nonatomic) void (^action)();
+(id)item;
+(id)itemWithLabel:(NSString *)inLabel;
++(id)itemWithLabel:(NSString *)inLabel action:(void(^)(void))action;
@end
View
7 RIButtonItem.m
@@ -24,5 +24,12 @@ +(id)itemWithLabel:(NSString *)inLabel
return newItem;
}
++(id)itemWithLabel:(NSString *)inLabel action:(void(^)(void))action
+{
+ id newItem = [self itemWithLabel:inLabel];
+ [newItem setAction:action];
@MrNickBarker
MrNickBarker Jun 17, 2013

This throws an error "Sending 'void (^__strong)(void)' to parameter of incompatible type 'SEL' (aka 'SEL *')"

@p-l
p-l Jun 26, 2013

I've made a pull request regarding this.

+ return newItem;
+}
+
@end

0 comments on commit e2c23df

Please sign in to comment.