-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetupViewController.m
87 lines (60 loc) · 1.94 KB
/
SetupViewController.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
//
// SetupViewController.m
// Traffic Sense(new)
//
// Created by Alex Pereira on 3/11/12.
// Copyright (c) 2012 UBC. All rights reserved.
//
#import "SetupViewController.h"
@interface SetupViewController ()
@end
@implementation SetupViewController
@synthesize tripToggleButton = _tripToggleButton;
@synthesize mapButton = _mapButton;
@synthesize tripActive = _tripActive;
/*
* Handle IBAction events
*/
- (IBAction)tripToggleButtonPressed {
AppDelegate *myAppDelegate = [AppDelegate sharedAppdelegate];
if (!self.tripActive) {
[self.tripToggleButton setTitle:@"Stop Trip" forState:UIControlStateNormal];
self.tripActive = YES;
[self.navigationController pushViewController:myAppDelegate.mapViewController animated:YES];
self.mapButton.enabled = YES;
[self.mapButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
}
else {
[myAppDelegate.mapViewController viewDidUnload];
[myAppDelegate setMapViewController:nil];
[self.navigationController popToRootViewControllerAnimated:YES];
[self.tripToggleButton setTitle:@"Start Trip" forState:UIControlStateNormal];
self.tripActive = NO;
[self.mapButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
self.mapButton.enabled = NO;
}
}
- (IBAction)mapButtonPressed {
AppDelegate *myAppDelegate = [AppDelegate sharedAppdelegate];
[self.navigationController pushViewController:myAppDelegate.mapViewController animated:YES];
}
/*
* Handle system events
*/
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"setup view did load");
//the state will be intentially false until the map view is instantiated
self.tripActive = NO;
}
- (void)viewDidUnload
{
self.tripToggleButton = nil;
[self setMapButton:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
NSLog(@"setup view did unload");
}
@end