AnsweredAssumed Answered

Confused: AGSMapViewCalloutDelegate and Graphic's InfoTemplateDelegate

Question asked by aconnolly on Apr 3, 2013
Latest reply on Apr 4, 2013 by aconnolly
I am confused as to how the AGSMapViewCalloutDelegate and the Graphics's infoTemplateDelegate work together.

I use a unique value renderer and a graphics layer in my map. The UVR symbolizes my graphics correctly, however when I add a simple info template delegate to each of my graphics in it's initializer tapping (or clicking) in simulator does not fire:

mapView:shouldShowCalloutForGraphic:

Why?

In my map view controller's viewDidLoad I hook up the map's calloutDelegate:

self.mapView.calloutDelegate = self;


I add the info template like this to my graphics. Record is a simple object I use to encapsulate data. Note that my template is added to a local mutable array of template object so as to be retained. When the app starts up the points are displayed correctly, but tapping on the graphics doesn't do anything. What am I doing wrong?

 Record *record = (Record*)[pointArray objectAtIndex:0];               NSMutableDictionary *attributeDictionary = [record mutableDictionaryForRecord];                 // Create attributes dictionary from record object  [attributeDictionary setObject:record.legendID forKey:legendAttribute];                         // Add legendID for legend attribute to be used by renderer               AGSPoint *point = [AGSPoint pointWithX:record.x y:record.y spatialReference:_sourceMapManager.map.spatialReference];              AGSCalloutTemplate* template = [[AGSCalloutTemplate alloc] init]; template.titleTemplate = @"${legendLabel}"; template.detailTemplate = @"${address}";              // Create graphic AGSGraphic *graphic = [AGSGraphic graphicWithGeometry:point                                                            symbol:nil                                                        attributes:attributeDictionary                                              infoTemplateDelegate:template];              [_sourceGraphicsLayer addGraphic:graphic]; [_graphicTemplates addObject:template];


Does this have anything to do with passing in a nil symbol and allowing the renderer to symbolize the graphics? I've read the docs and it doesn't appear to say anything about this.

Thanks,
- Aaron

Outcomes