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