forked from millenomi/muikit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathL0ActionSheet.m
77 lines (60 loc) · 1.75 KB
/
L0ActionSheet.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// L0ActionSheet.m
// MuiKit
//
// Created by ∞ on 12/05/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#if TARGET_OS_IPHONE
#import "L0ActionSheet.h"
@implementation L0ActionSheet
- (id)initWithTitle:(NSString *)title delegate:(id<UIActionSheetDelegate>)delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...;
{
[NSException raise:@"L0MethodUnavailableException" format:@"You cannot use the convenience initializer with L0ActionSheet instances. Use init instead."];
return nil;
}
- (id) init;
{
return [self initWithFrame:[UIScreen mainScreen].bounds];
}
- (id) initWithFrame:(CGRect) frame;
{
if (self = [super initWithFrame:frame]) {
buttonIdentifiers = [NSMutableArray new];
additionalData = [NSMutableDictionary new];
}
return self;
}
- (NSInteger) addButtonWithTitle:(NSString*) title;
{
[NSException raise:@"L0MethodUnavailableException" format:@"You cannot use this method with L0ActionSheet instances. Use addButtonWithTitle:identifier: instead."];
return -1;
}
- (NSInteger) addButtonWithTitle:(NSString*) title identifier:(id) identifier;
{
NSInteger i = [super addButtonWithTitle:title];
[buttonIdentifiers addObject:identifier];
return i;
}
- (id) identifierForButtonAtIndex:(NSInteger) index;
{
return [buttonIdentifiers objectAtIndex:index];
}
- (void)dealloc {
[buttonIdentifiers release];
[additionalData release];
[super dealloc];
}
- (id) valueForUndefinedKey:(NSString*) key;
{
return [additionalData objectForKey:key];
}
- (void) setValue:(id) v forUndefinedKey:(NSString*) k;
{
if (v)
[additionalData setObject:v forKey:k];
else
[additionalData removeObjectForKey:k];
}
@end
#endif