1
我試圖用「LongPress事件」向地圖添加註釋。使用LongPress事件創建註釋
public void OnLongPress(SKScreenPoint point)
{
SKCoordinate point1 = new SKCoordinate(point.GetX(), point.GetY());
SKAnnotation anno1 = new SKAnnotation(10);
anno1.Location = point1;
anno1.MininumZoomLevel = 10;
anno1.AnnotationType = SKAnnotation.SkAnnotationTypeBlue;
_mapView.AddAnnotation(anno1, SKAnimationSettings.AnimationNone);
System.Console.WriteLine(point1);
System.Console.WriteLine(point);
System.Console.WriteLine(anno1);
}
從Console.WriteLines我得到以下信息:
[540.9993896484375,1049.2178955078125]
SKScreenPoint [x=540.9994, y=1049.2179]
SKAnnotation [uniqueID=10, location=[540.9993896484375,1049.2178955078125], imagePath=null, imageSize=192, annotationType=33, mininumZoomLevel=10, offset=SKScreenPoint [x=0.0, y=0.0], annotationView=null]
我從我的屏幕上顯示的座標。但我需要地圖上的座標。
我該怎麼做? 有人可以幫我嗎? :)
謝謝。
謝謝!作品像一個魅力:) 有沒有可能保存這個註釋?當我重新打開地圖時,此自定義註釋消失。 是否還有可能添加多個註釋並保存它們? – Slade
你是什麼意思「重新打開地圖」(請添加一個代碼片段)。大多數如果你「恢復地圖」,那麼註釋應該仍然存在 – Ando
我很抱歉。我有和我的其他註釋一樣的annotaion-id ... – Slade