Is there a delegate, callback, or other method that can be used to detect that the extent of the map has been changed in the ESRI iOS SDK?


According to the class reference for AGSMapView, there are two NSNotifications that are broadcast whenever the map pans or zooms to a new extent. Set up a listener for those notifications.

The map component also broadcasts 2 notifications -

AGSMapViewDidEndPanningNotification and #AGSMapViewDidEndZoomingNotification .


As answered already, you can use the 2 notifications: AGSMapViewDidEndPanningNotification and AGSMapViewDidEndZoomingNotification

However, if you need more immediate feedback you can add an observer to the AGSMapVeiw's visibleAreaEnvelope property:

[self.mapView addObserver:self forKeyPath:@"visibleAreaEnvelope" options:NSKeyValueObservingOptionNew context:nil];

Then you can react to that change like so:

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
    if (
        [keyPath isEqualToString:@"resolution"] ||
        [keyPath isEqualToString:@"visibleAreaEnvelope"] ||
        [keyPath isEqualToString:@"rotationAngle"] ||
        [keyPath isEqualToString:@"mapScale"]){
        NSLog(@"   ---> %@ changed...", keyPath);
    else {
        [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.