PageRenderTime 21ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/samples/MarkerMurder/Classes/FlipsideViewController.m

http://github.com/route-me/route-me
Objective C | 89 lines | 54 code | 23 blank | 12 comment | 0 complexity | 5838c2d9e0d867707fca6f8d33d07b69 MD5 | raw file
  1. //
  2. // FlipsideViewController.m
  3. // SampleMap : Diagnostic map
  4. //
  5. #import "FlipsideViewController.h"
  6. #import "MarkerMurderAppDelegate.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. self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
  16. }
  17. /*
  18. // Override to allow orientations other than the default portrait orientation.
  19. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  20. // Return YES for supported orientations
  21. return (interfaceOrientation == UIInterfaceOrientationPortrait);
  22. }
  23. */
  24. - (void)didReceiveMemoryWarning {
  25. RMLog(@"didReceiveMemoryWarning %@", self);
  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 = [self.contents mapCenter];
  31. [centerLatitude setText:[NSString stringWithFormat:@"%f", mapCenter.latitude]];
  32. [centerLongitude setText:[NSString stringWithFormat:@"%f", mapCenter.longitude]];
  33. [zoomLevel setText:[NSString stringWithFormat:@"%.1f", self.contents.zoom]];
  34. [maxZoom setText:[NSString stringWithFormat:@"%.1f", self.contents.maxZoom]];
  35. [minZoom setText:[NSString stringWithFormat:@"%.1f", self.contents.minZoom]];
  36. }
  37. - (void)viewWillDisappear:(BOOL)animated {
  38. CLLocationCoordinate2D newMapCenter;
  39. newMapCenter.latitude = [[centerLatitude text] doubleValue];
  40. newMapCenter.longitude = [[centerLongitude text] doubleValue];
  41. [self.contents moveToLatLong:newMapCenter];
  42. [self.contents setZoom:[[zoomLevel text] floatValue]];
  43. [self.contents setMaxZoom:[[maxZoom text] floatValue]];
  44. [self.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. - (RMMapContents *)contents
  55. {
  56. return [(MarkerMurderAppDelegate *)[[UIApplication sharedApplication] delegate] mapContents];
  57. }
  58. - (IBAction)clearSharedNSURLCache
  59. {
  60. [[NSURLCache sharedURLCache] removeAllCachedResponses];
  61. }
  62. - (IBAction)clearMapContentsCachedImages
  63. {
  64. [self.contents removeAllCachedImages];
  65. }
  66. @end