0
我在這裏有一個關於定製註釋的問題。這裏是我如何顯示引腳,但我希望在用戶單擊引腳時將圖像插入到註釋中。我怎樣才能做到這一點?定製註釋
- (void) showMarkingOnMap:(Service *) ser
{
if (!self.mapView.loaded) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"iPoly"
message:@"Failed to load the map."
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil, nil];
[alert show];
[alert release];
return;
}
id<AGSLayerView> graphicsLayerView = [self.mapView.mapLayerViews objectForKey:@"GraphicsLayer"];
AGSGraphicsLayer *graphicsLayer = (AGSGraphicsLayer*)graphicsLayerView.agsLayer;
[graphicsLayer removeAllGraphics];
// Create a symbols png graphic
AGSPictureMarkerSymbol *genSymbol = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:@"pushpin.png"];
ServiceInfoTemplate *infoTemplate = [[ServiceInfoTemplate alloc] init];
AGSGraphic *genGraphic;
AGSPoint *genPt;
NSMutableDictionary *dic= [[NSMutableDictionary alloc] init];
[dic setObject:[ser name] forKey:@"NAME"];
if([ser.location isEqualToString: @"\n"] || (ser.location == nil)){
[dic setObject:@"" forKey:@"DESC"];
} else {
[dic setObject:[ser location] forKey:@"DESC"];
}
genPt = [AGSPoint pointWithX:[[ser xcoordinate] floatValue]
y:[[ser ycoordinate] floatValue]
spatialReference:self.mapView.spatialReference];
genGraphic = [[AGSGraphic alloc] initWithGeometry:genPt symbol:genSymbol attributes:dic infoTemplateDelegate:infoTemplate];
[graphicsLayer addGraphic:genGraphic];
[graphicsLayer dataChanged];
[self.mapView zoomWithFactor:0.1 atAnchorPoint:genPt.cgPoint animated:NO];
[self.mapView centerAtPoint:genPt animated:YES];
//CGPoint *pt = CGPointMake([[ser ycoordinate] floatValue], [[ser xcoordinate] floatValue]);
}