PageRenderTime 44ms CodeModel.GetById 40ms RepoModel.GetById 1ms app.codeStats 0ms

/samples/MapTestbedTwoMaps/Classes/FlipsideViewController.m

http://github.com/route-me/route-me
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. #import "FlipsideViewController.h"
  6. #import "MapTestbedTwoMapsAppDelegate.h"
  7. @implementation FlipsideViewController
  8. @synthesize centerLatitude;
  9. @synthesize centerLongitude;
  10. @synthesize zoomLevel;
  11. @synthesize minZoom;
  12. @synthesize maxZoom;
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. contents = [(MapTestbedTwoMapsAppDelegate *)[[UIApplication sharedApplication] delegate] upperMapContents];
  16. self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
  17. }
  18. /*
  19. // Override to allow orientations other than the default portrait orientation.
  20. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  21. // Return YES for supported orientations
  22. return (interfaceOrientation == UIInterfaceOrientationPortrait);
  23. }
  24. */
  25. - (void)didReceiveMemoryWarning {
  26. [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
  27. // Release anything that's not essential, such as cached data
  28. }
  29. - (void)viewDidAppear:(BOOL)animated {
  30. CLLocationCoordinate2D mapCenter = [contents mapCenter];
  31. [centerLatitude setText:[NSString stringWithFormat:@"%f", mapCenter.latitude]];
  32. [centerLongitude setText:[NSString stringWithFormat:@"%f", mapCenter.longitude]];
  33. [zoomLevel setText:[NSString stringWithFormat:@"%f", contents.zoom]];
  34. [maxZoom setText:[NSString stringWithFormat:@"%f", contents.maxZoom]];
  35. [minZoom setText:[NSString stringWithFormat:@"%f", contents.minZoom]];
  36. }
  37. - (void)viewWillDisappear:(BOOL)animated {
  38. CLLocationCoordinate2D newMapCenter;
  39. newMapCenter.latitude = [[centerLatitude text] doubleValue];
  40. newMapCenter.longitude = [[centerLongitude text] doubleValue];
  41. [contents moveToLatLong:newMapCenter];
  42. [contents setZoom:[[zoomLevel text] floatValue]];
  43. [contents setMaxZoom:[[maxZoom text] floatValue]];
  44. [contents setMinZoom:[[minZoom text] floatValue]];
  45. }
  46. - (void)dealloc {
  47. self.centerLatitude = nil;
  48. self.centerLongitude = nil;
  49. self.zoomLevel = nil;
  50. self.minZoom = nil;
  51. self.maxZoom = nil;
  52. [super dealloc];
  53. }
  54. @end