Here is the code to listen to notifications...// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.- (void)viewDidLoad { [super viewDidLoad]; //create an instance of a tiled map service layer //Add it to the map view //release to avoid memory leaks AGSTiledMapServiceLayer *tiledLayer = [[AGSTiledMapServiceLayer alloc] initWithURL:[NSURL URLWithString:kTiledMapServiceURL]]; [self.mapView addMapLayer:tiledLayer withName:@Tiled Layer]; [tiledLayer release]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(respondTo:)name:@MapDidEndPanning object:nil];}- (void)respondTo:(NSNotification *)notification { //do something with the notification here NSLog(@MapDidEndPanning);}Hope this helps!Regards,Nimesh
I double checked, zoom and pan actions turn OFF autoPan property but you have to make sure your GPS is on. Here is the code I've used.// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.- (void)viewDidLoad { [super viewDidLoad]; //create an instance of a tiled map service layer //Add it to the map view //release to avoid memory leaks AGSTiledMapServiceLayer *tiledLayer = [[AGSTiledMapServiceLayer alloc] initWithURL:[NSURL URLWithString:kTiledMapServiceURL]]; [self.mapView addMapLayer:tiledLayer withName:@Tiled Layer]; [tiledLayer release]; //create an instance of a dynmaic map layer //set visible layers //name the layer. This is the name that is displayed if there was a property page, tocs, etc... //set transparency self.dynamicLayer = [[[AGSDynamicMapServiceLayer alloc] initWithURL:[NSURL URLWithString:kDynamicMapServiceURL]] autorelease]; self.dynamicLayer.visibleLayers = [NSArray arrayWithObjects:[NSNumber numberWithInt:2], nil]; self.dynamicLayerView = [self.mapView addMapLayer:self.dynamicLayer withName:@Dynamic Layer]; self.dynamicLayerView.alpha = 0.5; self.mapView.gps.autoPan = YES; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(respondTo:)name:@MapDidEndPanning object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(respondToZooming:)name:@MapDidEndZooming object:nil];}- (void)respondTo:(NSNotification *)notification { NSLog(@MapDidEndPanning); NSLog(@autoPan = %@\n", (self.mapView.gps.autoPan ? @YES : @NO));}- (void)respondToZooming:(NSNotification *)notification { NSLog(@MapDidEndZooming); NSLog(@autoPan = %@\n", (self.mapView.gps.autoPan ? @YES : @NO)); }Regards,Nimesh
Akhlaq,Apologies, error in my test scenario. The autoPan property only turns OFF on pan actions and not zoom actions. It is been documented in the blog as following,***autoPan: property now defaults to NO. You need to enable it if you want the map to keep centering at the reported GPS location. Also, the autoPan property is automatically disabled when the user pans the map.***http://blogs.esri.com/Dev/blogs/mobilecentral/archive/2010/07/01/ArcGIS-API-for-iOS-_2800_Update-1_2900_.aspxRegards,Nimesh
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.