Skip to main content
fixing the code section
Source Link
Andre Silva
  • 10.3k
  • 12
  • 55
  • 109

As answered already, you can use the 2 notifications: AGSMapViewDidEndPanningNotificationAGSMapViewDidEndPanningNotification and AGSMapViewDidEndZoomingNotificationAGSMapViewDidEndZoomingNotification

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

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

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

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

}

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

}

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

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

}