forked from jivadevoe/UIAlertView-Blocks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
RIButtonItem.m
52 lines (41 loc) · 897 Bytes
/
RIButtonItem.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// RIButtonItem.m
// Shibui
//
// Created by Jiva DeVoe on 1/12/11.
// Copyright 2011 Random Ideas, LLC. All rights reserved.
//
#import "RIButtonItem.h"
@implementation RIButtonItem
@synthesize label;
@synthesize action;
+(id)item
{
return [self new];
}
+(id)itemWithLabel:(NSString *)inLabel
{
id newItem = [self item];
[newItem setLabel:inLabel];
return newItem;
}
+(id)itemWithLabel:(NSString *)label andAction:(void(^)())action
{
RIButtonItem *newItem = (RIButtonItem *)[self item];
newItem.label = label;
newItem.action = action;
return newItem;
}
- (id)initWithLabel:(NSString *)label {
return [self initWithLabel:nil andAction:nil];
}
- (id)initWithLabel:(NSString *)_label andAction:(void(^)())_action
{
self = [super init];
if (self) {
self.label = label;
self.action = action;
}
return self;
}
@end