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
|
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
|
-
+
-
-
+
+
-
-
+
+
-
+
|
{
[_siteStorage release];
[_tableView release];
[super dealloc];
}
- (NSInteger)tableView: (UITableView*)tableView
- (NSInteger)tableView: (UITableView *)tableView
numberOfRowsInSection: (NSInteger)section
{
return [self.siteStorage sitesCount];
}
- (UITableViewCell*)tableView: (UITableView*)tableView
cellForRowAtIndexPath: (NSIndexPath*)indexPath
- (UITableViewCell *)tableView: (UITableView *)tableView
cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier: @"site"];
if (cell == nil)
cell = [[[UITableViewCell alloc]
initWithStyle: UITableViewCellStyleDefault
reuseIdentifier: @"site"] autorelease];
cell.textLabel.text = [self.siteStorage.sites[indexPath.row] NSObject];
return cell;
}
- (void)tableView: (UITableView*)tableView
didSelectRowAtIndexPath: (NSIndexPath*)indexPath
- (void)tableView: (UITableView *)tableView
didSelectRowAtIndexPath: (NSIndexPath *)indexPath
{
[self performSegueWithIdentifier: @"showDetails"
sender: self];
}
- (void)prepareForSegue: (UIStoryboardSegue*)segue
- (void)prepareForSegue: (UIStoryboardSegue *)segue
sender: (id)sender
{
if ([segue.identifier isEqual: @"addSite"] ||
[segue.identifier isEqual: @"showDetails"])
[segue.destinationViewController setMainViewController: self];
}
@end
|