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

ログはキーに Allkeys をSampleID単独で与え、SurveyData,Which is an NSArray!を取得しません。なぜそうなのですか?

4

1 に答える 1

0

AGSGraphic の属性は、ArcGIS 10.1.1 から NSNull、NSString、NSDate、および NSNumber のみをサポートしているようです。ドキュメントを参照できます。

私の解決策は、AGSGraphic を必要な属性で拡張して、独自の AGSGraphic を構築することです。以下のようなもの:

@interface CustomAGSGraphic : AGSGraphic

@property(nonatomic,retain) NSMutableDictionary *attrDictionary;

@end

それは魅力のように機能します。それが役立つことを願っています。

于 2014-01-17T07:20:47.783 に答える