PageRenderTime 14ms CodeModel.GetById 1ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/samples/MapTestbed/Classes/FlipsideViewController.m

http://github.com/route-me/route-me
Objective C | 71 lines | 45 code | 19 blank | 7 comment | 0 complexity | cdec9f483a2bda4084becb9d5a6dc504 MD5 | raw file
 1//
 2//  FlipsideViewController.m
 3//  MapTestbed : Diagnostic map
 4//
 5
 6#import "FlipsideViewController.h"
 7#import "MapTestbedAppDelegate.h"
 8
 9
10@implementation FlipsideViewController
11
12@synthesize centerLatitude;
13@synthesize centerLongitude;
14@synthesize zoomLevel;
15@synthesize minZoom;
16@synthesize maxZoom;
17
18- (void)viewDidLoad {
19    [super viewDidLoad];
20    contents = [(MapTestbedAppDelegate *)[[UIApplication sharedApplication] delegate] mapContents];
21
22    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];      
23    
24}
25
26
27// Override to allow orientations other than the default portrait orientation.
28- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
29	// Return YES for supported orientations
30	return YES;
31}
32
33
34- (void)didReceiveMemoryWarning {
35    [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
36    // Release anything that's not essential, such as cached data
37}
38
39- (void)viewDidAppear:(BOOL)animated {
40    CLLocationCoordinate2D mapCenter = [contents mapCenter];
41
42    [centerLatitude setText:[NSString stringWithFormat:@"%f", mapCenter.latitude]];
43    [centerLongitude setText:[NSString stringWithFormat:@"%f", mapCenter.longitude]];
44    [zoomLevel setText:[NSString stringWithFormat:@"%f", contents.zoom]];
45    [maxZoom setText:[NSString stringWithFormat:@"%f", contents.maxZoom]];
46    [minZoom setText:[NSString stringWithFormat:@"%f", contents.minZoom]];
47
48}
49
50- (void)viewWillDisappear:(BOOL)animated {
51    CLLocationCoordinate2D newMapCenter;
52    
53    newMapCenter.latitude = [[centerLatitude text] doubleValue];
54    newMapCenter.longitude = [[centerLongitude text] doubleValue];
55    [contents moveToLatLong:newMapCenter];
56    [contents setZoom:[[zoomLevel text] floatValue]];
57    [contents setMaxZoom:[[maxZoom text] floatValue]];
58    [contents setMinZoom:[[minZoom text] floatValue]];
59}
60
61- (void)dealloc {
62    self.centerLatitude = nil;
63    self.centerLongitude = nil;
64    self.zoomLevel = nil;
65    self.minZoom = nil;
66    self.maxZoom = nil;    
67    [super dealloc];
68}
69
70
71@end