-
Notifications
You must be signed in to change notification settings - Fork 4
/
CallRemindersDelegates.m
88 lines (69 loc) · 2.44 KB
/
CallRemindersDelegates.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
78
79
80
81
82
83
84
85
86
87
88
#import "CallRemindersDelegates.h"
@implementation CRUIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
addressesTableView.delegate = nil;
[tableViewDelegate release];
tableViewDelegate = nil;
addressesTableView.dataSource = nil;
[tableViewDataSource release];
tableViewDataSource = nil;
[addressesTableView release];
addressesTableView = nil;
addressesAlertView.delegate = nil;
[alertViewDelegate release];
alertViewDelegate = nil;
[addressesAlertView release];
addressesAlertView = nil;
[addressArray release];
addressArray = nil;
[kindArray release];
kindArray = nil;
}
@end
@implementation CRUITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[addressesAlertView dismissWithClickedButtonIndex:0 animated:YES];
NSString *address = [addressArray objectAtIndex:indexPath.row];
address = [address stringByReplacingOccurrencesOfString:@" " withString:@""];
address = [address stringByReplacingOccurrencesOfString:@"-" withString:@""];
address = [address stringByReplacingOccurrencesOfString:@"(" withString:@""];
address = [address stringByReplacingOccurrencesOfString:@")" withString:@""];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", address]]];
addressesTableView.delegate = nil;
[tableViewDelegate release];
tableViewDelegate = nil;
addressesTableView.dataSource = nil;
[tableViewDataSource release];
tableViewDataSource = nil;
[addressesTableView release];
addressesTableView = nil;
addressesAlertView.delegate = nil;
[alertViewDelegate release];
alertViewDelegate = nil;
[addressesAlertView release];
addressesAlertView = nil;
[addressArray release];
addressArray = nil;
[kindArray release];
kindArray = nil;
}
@end
@implementation CRUITableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"any-cell"];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"any-fucking-cell"] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.textLabel.text = [kindArray objectAtIndex:indexPath.row];
}
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [addressArray count];
}
@end