/samples/MapTestbedTwoMaps/Classes/MainViewController.m
Objective C | 86 lines | 50 code | 22 blank | 14 comment | 1 complexity | 426a3a82f8796335eb96c49b124b83a1 MD5 | raw file
1// 2// MainViewController.m 3// MapTestbed : Diagnostic map 4// 5 6#import "MainViewController.h" 7#import "MapTestbedTwoMapsAppDelegate.h" 8#import "RMMapContents.h" 9#import "RMCloudMadeMapSource.h" 10#import "RMVirtualEarthSource.h" 11 12#import "MainView.h" 13 14@implementation MainViewController 15 16@synthesize upperMapView; 17@synthesize lowerMapView; 18 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// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 28- (void)viewDidLoad { 29 LogMethod(); 30 [super viewDidLoad]; 31 32 CLLocationCoordinate2D center; 33 center.latitude = 47.592; 34 center.longitude = -122.333; 35 36 [upperMapView setDelegate:self]; 37 RMMapContents *upperMapContents = [[RMMapContents alloc] initWithView:upperMapView 38 tilesource:[[[RMVirtualEarthSource alloc] initWithHybridThemeUsingAccessKey:@"invalidKey"] autorelease]]; 39 [upperMapView setNeedsLayout]; 40 [upperMapView setNeedsDisplay]; 41 [upperMapView moveToLatLong:center]; 42 43 [lowerMapView setDelegate:self]; 44 RMMapContents *lowerMapContents = [[RMMapContents alloc] initWithView:lowerMapView 45 tilesource:[[[RMCloudMadeMapSource alloc] initWithAccessKey:@"0199bdee456e59ce950b0156029d6934" styleNumber:7] autorelease]]; 46 [lowerMapView setNeedsDisplay]; 47 [lowerMapView moveToLatLong:center]; 48 49 NSLog(@"%@ %@", upperMapContents, lowerMapContents); 50} 51 52 53/* 54 // Override to allow orientations other than the default portrait orientation. 55 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 56 // Return YES for supported orientations 57 return (interfaceOrientation == UIInterfaceOrientationPortrait); 58 } 59*/ 60 61 62- (void)didReceiveMemoryWarning { 63 [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview 64 // Release anything that's not essential, such as cached data 65} 66 67- (void)viewDidAppear:(BOOL)animated { 68} 69 70- (void)dealloc { 71 self.upperMapView = nil; 72 self.lowerMapView = nil; 73 [super dealloc]; 74} 75 76#pragma mark - 77#pragma mark Delegate methods 78 79- (void) afterMapMove: (RMMapView*) map { 80} 81 82- (void) afterMapZoom: (RMMapView*) map byFactor: (float) zoomFactor near:(CGPoint) center { 83} 84 85 86@end