AGSGraphic *graphic;
AGSPoint *graphicPoint;
NSMutableDictionary *graphicAttributes;
AGSPictureMarkerSymbol *graphicSymbol;
//Graphic for demonstrating custom callout with buttons
graphicPoint = [AGSPoint pointWithX:sample.latitude y:sample.longitude spatialReference:self.mapView.spatialReference];
graphicAttributes=[[NSMutableDictionary alloc]initWithCapacity:3];
[graphicAttributes setObject:[NSString stringWithFormat:@"%d",sample.sampleId] forKey:@"SampleID"];
[graphicAttributes setObject:mapData.SurveyData forKey:@"SurveyData" ];
NSLog(@"%@",[graphicAttributes objectForKey:@"SurveyData"]);
NSLog(@"%@", [graphicAttributes allKeys]);
graphicSymbol = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:@"MapPin_Blue.png"];
graphic = [AGSGraphic graphicWithGeometry:graphicPoint symbol:graphicSymbol attributes:graphicAttributes infoTemplateDelegate:self];
NSLog(@"%@", [[graphic allAttributes] allKeys]);
[self.graphicsLayer addGraphic:graphic];
日志仅为SampleID
提供密钥,而不是SurveyData
,这是NSArray
!
为什么会这样?
答案 0 :(得分:0)
似乎AGSGraphic的属性仅支持ArcGIS 10.1.1中的NSNull,NSString,NSDate和NSNumber。您可以参考这些文档。
我的解决方案是通过使用您需要的任何属性扩展AGSGraphic来构建我自己的AGSGraphic。如下所示:
@interface CustomAGSGraphic : AGSGraphic
@property(nonatomic,retain) NSMutableDictionary *attrDictionary;
@end
它就像一个魅力。希望它可以提供帮助。