// MapViewController.h #import <ArcGIS/ArcGIS.h> @interface MapViewController : UIViewController <AGSMapViewLayerDelegate> { AGSMapView *_mapView; } @end // MapViewController.m - (id)init { self = [super init]; if (self) { _mapView = [[AGSMapView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)]; //_mapView.layer.delegate = self; NSMutableArray *layers =[[NSMutableArray alloc] init]; NSURL *tileUrl = [NSURL URLWithString:@"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"]; AGSTiledMapServiceLayer *tiledLayer = [[AGSTiledMapServiceLayer alloc] initWithURL:tileUrl]; UIView<AGSLayerView>* tileLyrView = [_mapView addMapLayer:tiledLayer withName:@Tiled Layer]; [layers addObject:tileLyrView]; NSURL* dynamicUrl = [NSURL URLWithString: @"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer"]; AGSDynamicMapServiceLayer* dynamicLayer = [AGSDynamicMapServiceLayer dynamicMapServiceLayerWithURL: dynamicUrl]; UIView<AGSLayerView>* dynamicLyrView = [_mapView addMapLayer:dynamicLayer withName:@Dynamic Layer]; [layers addObject:dynamicLyrView]; // Not using yet AGSGraphicsLayer *graphicsLayer = [AGSGraphicsLayer graphicsLayer]; UIView<AGSLayerView>* graphicLyrView = [_mapView addMapLayer:graphicsLayer withName:@Graphics Layer]; [graphicLyrView setDrawDuringPanning:YES]; [layers addObject:graphicLyrView]; [self setView:_mapView]; } return self; } - (void)mapViewDidLoad:(AGSMapView *)mapView { // Never fires or crashes before it fires, not sure which one NSLog(@%@", @mapViewDidLoad); }
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.