PageRenderTime 44ms CodeModel.GetById 8ms app.highlight 31ms RepoModel.GetById 1ms app.codeStats 1ms

/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
 9#import "ProgrammaticMapViewController.h"
10#import "RMMapView.h"
11
12@implementation ProgrammaticMapViewController
13
14@synthesize mapView;
15
16
17/*
18// The designated initializer. Override to perform setup that is required before the view is loaded.
19- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
20    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
21        // Custom initialization
22    }
23    return self;
24}
25*/
26
27/*
28// Implement loadView to create a view hierarchy programmatically, without using a nib.
29- (void)loadView {
30}
31*/
32
33
34
35- (void)viewDidLoad {
36	NSLog(@"viewDidLoad");
37    [super viewDidLoad];
38	
39	CLLocationCoordinate2D firstLocation;
40	firstLocation.latitude = 51.2795;
41	firstLocation.longitude = 1.082;
42	self.mapView = [[[RMMapView alloc] initWithFrame:CGRectMake(10,20,200,300)
43										WithLocation:firstLocation] autorelease];
44//	[[mapView contents] setZoom:10.0];
45	[mapView setBackgroundColor:[UIColor greenColor]];
46	[[self view] addSubview:mapView];
47	[[self view] sendSubviewToBack:mapView];
48}
49
50
51
52/*
53// Override to allow orientations other than the default portrait orientation.
54- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
55    // Return YES for supported orientations
56    return (interfaceOrientation == UIInterfaceOrientationPortrait);
57}
58*/
59
60
61- (void)didReceiveMemoryWarning {
62    [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
63    // Release anything that's not essential, such as cached data
64	[mapView didReceiveMemoryWarning];
65}
66
67
68- (void)dealloc {
69    [mapView removeFromSuperview];
70	self.mapView = nil;
71	[super dealloc];
72}
73
74- (IBAction) doTheTest:(id)sender
75{
76	CLLocationCoordinate2D secondLocation;
77	secondLocation.latitude = -43.63;
78	secondLocation.longitude = 172.66;
79	[[[self mapView] contents] moveToLatLong:secondLocation];
80}
81
82@end