FlipsideViewController.m
2.38 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
//
// FlipsideViewController.m
// SampleMap : Diagnostic map
//
#import "FlipsideViewController.h"
#import "SampleMapAppDelegate.h"
@implementation FlipsideViewController
@synthesize centerLatitude;
@synthesize centerLongitude;
@synthesize zoomLevel;
@synthesize minZoom;
@synthesize maxZoom;
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
RMLog(@"didReceiveMemoryWarning %@", self);
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)viewDidAppear:(BOOL)animated {
CLLocationCoordinate2D mapCenter = [self.contents mapCenter];
[centerLatitude setText:[NSString stringWithFormat:@"%f", mapCenter.latitude]];
[centerLongitude setText:[NSString stringWithFormat:@"%f", mapCenter.longitude]];
[zoomLevel setText:[NSString stringWithFormat:@"%.1f", self.contents.zoom]];
[maxZoom setText:[NSString stringWithFormat:@"%.1f", self.contents.maxZoom]];
[minZoom setText:[NSString stringWithFormat:@"%.1f", self.contents.minZoom]];
}
- (void)viewWillDisappear:(BOOL)animated {
CLLocationCoordinate2D newMapCenter;
newMapCenter.latitude = [[centerLatitude text] doubleValue];
newMapCenter.longitude = [[centerLongitude text] doubleValue];
[self.contents moveToLatLong:newMapCenter];
[self.contents setZoom:[[zoomLevel text] floatValue]];
[self.contents setMaxZoom:[[maxZoom text] floatValue]];
[self.contents setMinZoom:[[minZoom text] floatValue]];
}
- (void)dealloc {
self.centerLatitude = nil;
self.centerLongitude = nil;
self.zoomLevel = nil;
self.minZoom = nil;
self.maxZoom = nil;
[super dealloc];
}
- (RMMapContents *)contents
{
return [(SampleMapAppDelegate *)[[UIApplication sharedApplication] delegate] mapContents];
}
- (IBAction)clearSharedNSURLCache
{
[[NSURLCache sharedURLCache] removeAllCachedResponses];
}
- (IBAction)clearMapContentsCachedImages
{
[self.contents removeAllCachedImages];
}
@end