Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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 .

share|improve this answer
add comment

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];
}

}

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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