-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapInfoViewController.m
More file actions
executable file
·96 lines (82 loc) · 2.52 KB
/
Copy pathMapInfoViewController.m
File metadata and controls
executable file
·96 lines (82 loc) · 2.52 KB
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
89
90
91
92
93
94
95
96
//
// DBEntryViewController.m
// WifiCap
//
// Created by Junfeng Shen on 19/2/12.
// Copyright (c) 2012 SYSU. All rights reserved.
//
#import "MapInfoViewController.h"
@implementation MapInfoViewController
@synthesize entry;
- (id)initWithEntry:(mapInfo*)aEntry{
self = [super initWithStyle:UITableViewStyleGrouped];
self.entry = aEntry;
db = [[DatabaseOperation alloc] init];
return self;
}
- (void)dealloc{
[self.entry release];
[db release];
[super dealloc];
}
#pragma mark - View lifecycle
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.entry.pCount = [db getPointCountForMap:self.entry];
[self.tableView reloadData];
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.title = @"DataBase Info";
UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"Enter" style:UIBarButtonItemStyleBordered target:self action:@selector(enterMap)];
self.navigationItem.rightBarButtonItem = barButton;
[barButton release];
}
- (void)enterMap{
MapViewController *mvC = [[MapViewController alloc] initWithMapInfo:entry];
[self.navigationController pushViewController:mvC animated:YES];
[mvC release];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"entryCell"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"entryCell"] autorelease];
}
switch (indexPath.row) {
case 0:
cell.textLabel.text = @"Name";
cell.detailTextLabel.text = self.entry.name;
break;
case 1:
cell.textLabel.text = @"Location";
cell.detailTextLabel.text = self.entry.location;
break;
case 2:
cell.textLabel.text = @"Description";
cell.detailTextLabel.text = self.entry.description;
break;
case 3:
cell.textLabel.text = @"Point Count";
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", self.entry.pCount];
break;
default:
break;
}
return cell;
}
- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return @"Basic Information";
}
#pragma mark - Table view delegate
- (NSIndexPath*)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath{
return nil;
}
@end