// ViewController.m #import <ArcGIS/ArcGIS.h> @interface ViewController () <AGSMapViewLayerDelegate> { IBOutlet AGSMapView *map; } @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; NSString *mapLocation = @"https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"; AGSTiledMapServiceLayer *basemapServiceLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:[NSURL URLWithString:mapLocation]]; [map addMapLayer:basemapServiceLayer withName:@"Tiled Layer"]; map.layerDelegate = self; } -(void)mapViewDidLoad:(AGSMapView *)mapView { [map.locationDisplay startDataSource]; if(map.loaded) { double x = 5.0; double y = 52.5; zoomDegrees = 0.005 AGSEnvelope *envelope = [AGSEnvelope envelopeWithXmin:x - zoomDegrees ymin:y - zoomDegrees xmax:x + zoomDegrees ymax:y + zoomDegrees spatialReference:map.spatialReference]; // Zooms in on the equator: [map zoomToEnvelope:envelope animated:YES]; // Does nothing at all: // [map zoomWithFactor:4 atAnchorPoint:CGPointMake(50, 80) animated:YES]; } } @end
Solved! Go to Solution.
AGSEnvelope *envelope = [AGSEnvelope envelopeWithXmin:x - zoomDegrees ymin:y - zoomDegrees xmax:x + zoomDegrees ymax:y + zoomDegrees spatialReference:[AGSSpatialReference wgs84SpatialReference]];