PageRenderTime 3ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

/samples/ProgrammaticMap/Classes/ProgrammaticMapViewController.m

http://github.com/route-me/route-me
Objective C | 82 lines | 33 code | 19 blank | 30 comment | 0 complexity | e168b0bcb2e6d5dda22a504a84e455cf MD5 | raw file
  1. //
  2. // ProgrammaticMapViewController.m
  3. // ProgrammaticMap
  4. //
  5. // Created by Hal Mueller on 3/25/09.
  6. // Copyright Route-Me Contributors 2009. All rights reserved.
  7. //
  8. #import "ProgrammaticMapViewController.h"
  9. #import "RMMapView.h"
  10. @implementation ProgrammaticMapViewController
  11. @synthesize mapView;
  12. /*
  13. // The designated initializer. Override to perform setup that is required before the view is loaded.
  14. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
  15. if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
  16. // Custom initialization
  17. }
  18. return self;
  19. }
  20. */
  21. /*
  22. // Implement loadView to create a view hierarchy programmatically, without using a nib.
  23. - (void)loadView {
  24. }
  25. */
  26. - (void)viewDidLoad {
  27. NSLog(@"viewDidLoad");
  28. [super viewDidLoad];
  29. CLLocationCoordinate2D firstLocation;
  30. firstLocation.latitude = 51.2795;
  31. firstLocation.longitude = 1.082;
  32. self.mapView = [[[RMMapView alloc] initWithFrame:CGRectMake(10,20,200,300)
  33. WithLocation:firstLocation] autorelease];
  34. // [[mapView contents] setZoom:10.0];
  35. [mapView setBackgroundColor:[UIColor greenColor]];
  36. [[self view] addSubview:mapView];
  37. [[self view] sendSubviewToBack:mapView];
  38. }
  39. /*
  40. // Override to allow orientations other than the default portrait orientation.
  41. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  42. // Return YES for supported orientations
  43. return (interfaceOrientation == UIInterfaceOrientationPortrait);
  44. }
  45. */
  46. - (void)didReceiveMemoryWarning {
  47. [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
  48. // Release anything that's not essential, such as cached data
  49. [mapView didReceiveMemoryWarning];
  50. }
  51. - (void)dealloc {
  52. [mapView removeFromSuperview];
  53. self.mapView = nil;
  54. [super dealloc];
  55. }
  56. - (IBAction) doTheTest:(id)sender
  57. {
  58. CLLocationCoordinate2D secondLocation;
  59. secondLocation.latitude = -43.63;
  60. secondLocation.longitude = 172.66;
  61. [[[self mapView] contents] moveToLatLong:secondLocation];
  62. }
  63. @end