AnsweredAssumed Answered

AGSFeatureLayer does not redraw or respond to touches

Question asked by geonetadmin on Mar 27, 2014
Latest reply on Mar 27, 2014 by geoace67
Original User: geoace67

Hello all. I'm having some trouble loading AGSFeatureLayers.
I start out by adding a TPK, then two AGSFeatureLayers.

    self.mapView.allowCallout = YES;
    self.mapView.callout.delegate = self;
    self.mapView.touchDelegate = self;
    self.mapView.layerDelegate = self;

    NSString *tilePackagePath = [[NSBundle mainBundle] pathForResource:@"my_tile_package" ofType:@"tpk"];
    AGSLocalTiledLayer *localTiledLayer = [AGSLocalTiledLayer localTiledLayerWithPath:tilePackagePath];
    if(localTiledLayer != nil)
        NSLog(@"Loading TPK...");
        localTiledLayer.delegate = self;
        [self.mapView addMapLayer:localTiledLayer withName:@"Tiled_BG"];
        NSLog(@"TPK does not exist");

    [self.mapView addMapLayer:self.featureLayer1 withName:@"Features1"];
    [self.mapView addMapLayer:self.featureLayer2 withName:@"Features2"];
    self.featureLayer1.allowCallout = YES;
    self.featureLayer1.calloutDelegate = self;
    self.featureLayer1.delegate = self;
    self.featureLayer2.allowCallout = YES;
    self.featureLayer2.calloutDelegate = self;
    self.featureLayer2.delegate = self;

The TPK and AGSFeatureLayers load just fine, but there are two big issues.

First, the AGSFeatureLayers are not visible initially. As soon as you pan the map, they are redrawn and become visible. Zooming does not make the feature layers redraw, unless that zoom action reaches the max or min zoom of the TPK. In the following screenshots, you can see the effect this has. The application was launched, and the map was dragged to make the featureLayers visible. The map was then zoomed, but this action alone does not cause the AGSFeatureLayers to redraw (first screenshot). Then the map is panned, and the layers redraw (second screenshot).

Secondly, the AGSFeatureLayers do not respond to callout delegate methods. The map itself responds to AGSMapViewTouchDelegate and other delegate methods, but I can't get any response from the AGSFeatureLayers.

Any thoughts or ideas? I'm stumped.
Thanks in advance!